php-censor/tests/PHPCensor/Security/Authentication/UserProvider/InternalTest.php
SimonHeimberg 7a8ed48e3d test cases inherit from PhpUnit testcase with namespeces
This name is available since phpunit 4.8.36 and 5.4.3.
2017-07-24 08:59:49 +02:00

50 lines
1.1 KiB
PHP

<?php
namespace Tests\PHPCensor\Security\Authentication\UserProvider;
use PHPCensor\Model\User;
use PHPCensor\Security\Authentication\UserProvider\Internal;
class InternalTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Internal
*/
protected $provider;
protected function setUp()
{
$this->provider = new Internal('internal', [
'type' => 'internal',
]);
}
public function testVerifyPassword()
{
$user = new User();
$password = 'bla';
$user->setHash(password_hash($password, PASSWORD_DEFAULT));
$this->assertTrue($this->provider->verifyPassword($user, $password));
}
public function testVerifyInvaldPassword()
{
$user = new User();
$password = 'foo';
$user->setHash(password_hash($password, PASSWORD_DEFAULT));
$this->assertFalse($this->provider->verifyPassword($user, 'bar'));
}
public function testCheckRequirements()
{
$this->provider->checkRequirements();
}
public function testProvisionUser()
{
$this->assertNull($this->provider->provisionUser('john@doe.com'));
}
}