/** * @test * @group library */ public function success() { $attributes = array('email' => '*****@*****.**', 'lastname' => 'create test', 'firstname' => 'service user', 'gender' => 'm', 'isSuperuser' => false, 'isDeletable' => true); $newUser = $this->service->create($attributes); $this->assertInstanceOf('Cms\\Data\\User', $newUser); $this->assertSame($attributes['email'], $newUser->getEmail()); $this->assertSame($attributes['lastname'], $newUser->getLastname()); $this->assertSame($attributes['firstname'], $newUser->getFirstname()); $this->assertSame($attributes['gender'], $newUser->getGender()); $this->assertSame($attributes['isSuperuser'], $newUser->isSuperuser()); $this->assertSame($attributes['isDeletable'], $newUser->isDeletable()); $uuidValidator = new UniqueIdValidator(\Orm\Data\User::ID_PREFIX, \Orm\Data\User::ID_SUFFIX); $this->assertTrue($uuidValidator->isValid($newUser->getId())); // Timestamp der letzten Aenderung darf nicht aelter sein als ein paar Sekunden $this->assertNotNull($newUser->getLastupdate()); $currentTime = time(); $this->assertLessThanOrEqual($currentTime, $newUser->getLastupdate()); $this->assertGreaterThan($currentTime - 2, $newUser->getLastupdate()); }