Exemplo n.º 1
0
 public function testActivate()
 {
     $this->user->activate();
     $this->assertEquals('*****@*****.**', $this->user->getEmail());
     $this->assertEquals('john', $this->user->getUsername());
     $this->assertEquals('John', $this->user->getName());
     $this->assertEquals('Smith', $this->user->getSurname());
     $this->assertNotEmpty($this->user->getPassword());
     $this->assertEmpty($this->user->getCode());
     $this->assertFalse($this->user->isFrozen());
     $this->assertInstanceOf(DateTime::class, $this->user->getCreatedAt());
     $this->assertInstanceOf(ReadOnlyCollectionWrapper::class, $this->user->getRoles());
 }
Exemplo n.º 2
0
 public function testAuthenticateSuccess()
 {
     $role = new Role('customer', null);
     $user = new User('*****@*****.**', 'john', 'John', 'Smith', 'password');
     $user->activate();
     $user->addRole($role);
     $identity = $this->authenticator->authenticate(['authenticator' => Authenticator::AUTH_EMAIL, 'user' => $user, 'password' => 'password']);
     $this->assertEquals(new Identity(null, ['customer']), $identity);
 }