Adldap\Laravel\Tests\DatabaseProviderTest::test_auth_passes PHP Метод

test_auth_passes() публичный Метод

public test_auth_passes ( $credentials = null )
    public function test_auth_passes($credentials = null)
    {
        $credentials = $credentials ?: ['email' => '[email protected]', 'password' => '12345'];
        $user = $this->getMockUser(['cn' => '', 'mail' => '[email protected]', 'samaccountname' => 'jdoe']);
        $connection = $this->getMockConnection();
        $connection->expects($this->exactly(1))->method('isBound')->willReturn(true);
        $connection->expects($this->exactly(1))->method('search')->willReturn('resource');
        $connection->expects($this->exactly(1))->method('getEntries')->willReturn(['count' => 1, $user->getAttributes()]);
        $connection->expects($this->exactly(2))->method('bind')->with($this->logicalOr($this->equalTo('jdoe'), $this->equalTo('admin')))->willReturn(true);
        Event::shouldReceive('fire')->atLeast()->times(4)->withAnyArgs();
        $this->assertTrue(Auth::attempt($credentials));
        $user = Auth::user();
        $this->assertEquals($credentials['email'], $user->email);
        $this->assertTrue(Hash::check($credentials['password'], $user->password));
    }