12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- use Luticate\Auth\Controller\LuUsersController;
- use Luticate\Auth\Dbo\Users\LuUsersAddDbo;
- use Luticate\Utils\Controller\LuticateApplication;
- use Luticate\Utils\DataAccess\LuDataAccess;
-
- /**
- * Created by PhpStorm.
- * User: robin
- * Date: 9/18/16
- * Time: 1:02 AM
- */
-
- class Db extends LuDataAccess
- {
- protected static $_connection = "luticatedb";
- }
-
- class LuUsersTest extends \PHPUnit_Framework_TestCase
- {
- protected function getCtrl()
- {
- return new LuUsersController();
- }
-
- public static function setUpBeforeClass()
- {
- Db::getPdo()->query("DELETE FROM lu_users WHERE username LIKE '_test_%'");
- }
-
- public function testUserAdd1()
- {
- $ctrl = static::getCtrl();
-
- $newUser = new LuUsersAddDbo();
- $newUser->setUsername("_test_user1");
- $newUser->setPassword("test42");
- $newUser->setFirstname("Test");
- $newUser->setLastname("user1");
- $newUser->setEmail("test.user1@example.com");
- $newUser->setExternalAuth(null);
- $newUser->setProfileId(null);
-
- $user = $ctrl->add($newUser);
-
- $this->assertNotNull($user);
- $this->assertNotNull($user->getId());
- $this->assertSame($user->getUsername(), "_test_user1");
- $this->assertSame($user->getFirstname(), "Test");
- $this->assertSame($user->getLastname(), "user1");
- $this->assertSame($user->getEmail(), "test.user1@example.com");
- $this->assertNull($user->getExternalAuth());
- $this->assertNull($user->getProfileId());
- }
- }
|