public function testProvider()
 {
     $provider = new HashingServiceProvider($this->ioc);
     $provider->register();
     $provider->boot();
     $this->assertInstanceOf(Crc32FastHasher::class, $this->ioc->make(FastHasher::class));
     $this->assertInstanceOf(Sha1WeakHasher::class, $this->ioc->make(WeakHasher::class));
     $this->assertInstanceOf(Sha256StrongHasher::class, $this->ioc->make(StrongHasher::class));
     $this->assertInstanceOf(BcryptPasswordHasher::class, $this->ioc->make(PasswordHasher::class));
     $this->assertSame($this->ioc->make(FastHasher::class), $this->ioc->make(FastHasher::class));
     $this->assertSame($this->ioc->make(WeakHasher::class), $this->ioc->make(WeakHasher::class));
     $this->assertSame($this->ioc->make(StrongHasher::class), $this->ioc->make(StrongHasher::class));
     $this->assertSame($this->ioc->make(PasswordHasher::class), $this->ioc->make(PasswordHasher::class));
 }
Exemplo n.º 2
0
 public function testProvider()
 {
     $provider = new HashingServiceProvider($this->ioc);
     $provider->register();
     $provider->boot();
     $this->assertInstanceOf(Crc32FastHasher::class, $this->ioc->make(FastHasher::class));
     $this->assertInstanceOf(Sha1WeakHasher::class, $this->ioc->make(WeakHasher::class));
     $this->assertInstanceOf(Sha256StrongHasher::class, $this->ioc->make(StrongHasher::class));
     $this->assertInstanceOf(BcryptPasswordHasher::class, $this->ioc->make(PasswordHasher::class));
     $this->assertSame($this->ioc->make(FastHasher::class), $this->ioc->make(FastHasher::class));
     $this->assertSame($this->ioc->make(WeakHasher::class), $this->ioc->make(WeakHasher::class));
     $this->assertSame($this->ioc->make(StrongHasher::class), $this->ioc->make(StrongHasher::class));
     $this->assertSame($this->ioc->make(PasswordHasher::class), $this->ioc->make(PasswordHasher::class));
     $this->assertTrue($this->ioc->make(FastHash::class, [hash('crc32', 'test')])->check('test'));
     $this->assertTrue($this->ioc->make(WeakHash::class, [hash('sha1', 'test')])->check('test'));
     $this->assertTrue($this->ioc->make(StrongHash::class, [hash('sha256', 'test')])->check('test'));
     $this->assertTrue($this->ioc->make(PasswordHash::class, [password_hash('testtest', PASSWORD_BCRYPT)])->check(new Password('testtest')));
 }