diff --git a/.travis.yml b/.travis.yml index 844841b..6baf508 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,18 @@ matrix: - php: 8.0 env: - DEPS=latest + - php: 8.1 + env: + - DEPS=lowest + - php: 8.1 + env: + - DEPS=latest + - php: 8.2 + env: + - DEPS=lowest + - php: 8.2 + env: + - DEPS=latest - php: nightly env: - DEPS=lowest diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d7d2ec5..1946e78 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,39 +1,27 @@ - - - ./tests - - - - - - - - - - - - - - - - - ./src - Module.php - - - - - - - + + + + ./src + Module.php + + + + + + + + ./tests + + + + + + + + + + + + diff --git a/tests/Authentication/Adapter/DbTest.php b/tests/Authentication/Adapter/DbTest.php index b872b80..dd40307 100644 --- a/tests/Authentication/Adapter/DbTest.php +++ b/tests/Authentication/Adapter/DbTest.php @@ -2,6 +2,7 @@ namespace LmcUserTest\Authentication\Adapter; +use Laminas\Crypt\Password\Bcrypt; use Laminas\EventManager\Event; use LmcUser\Authentication\Adapter\Db; use PHPUnit\Framework\TestCase; @@ -199,6 +200,15 @@ public function testAuthenticateWithWrongPassword() ->method('getPasswordCost') ->willReturn(4); + $bcrypt = new Bcrypt([ + 'cost' => 4, + ]); + + $hash = $bcrypt->create('123456'); + $this->user->expects($this->once()) + ->method('getPassword') + ->willReturn($hash); + $this->authEvent->expects($this->once()) ->method('setCode') ->with(\Laminas\Authentication\Result::FAILURE_CREDENTIAL_INVALID) diff --git a/tests/Mapper/UserTest.php b/tests/Mapper/UserTest.php index 3b8a07f..0191e26 100644 --- a/tests/Mapper/UserTest.php +++ b/tests/Mapper/UserTest.php @@ -68,6 +68,16 @@ class UserTest extends TestCase */ protected $mockedDbAdapterPlatform; + /** + * @var \Laminas\Db\Adapter\Driver\StatementInterface + */ + protected $mockedDbAdapterStatement; + + /** + * @var \Laminas\Db\Sql\Platform\Platform + */ + protected $mockedDbSqlPlatform; + public function setUp():void { $mapper = new Mapper; diff --git a/tests/Service/UserTest.php b/tests/Service/UserTest.php index 49c7aa1..400be4e 100644 --- a/tests/Service/UserTest.php +++ b/tests/Service/UserTest.php @@ -88,13 +88,14 @@ public function testRegisterWithInvalidForm() */ public function testRegisterWithUsernameAndDisplayNameUserStateDisabled() { - $expectArray = array('username' => 'LmcUser', 'display_name' => 'Zfc User'); + $expectArray = array('username' => 'LmcUser', 'display_name' => 'Zfc User', 'password' => '123456'); $user = $this->createMock('LmcUser\Entity\User'); $user->expects($this->once()) ->method('setPassword'); $user->expects($this->once()) - ->method('getPassword'); + ->method('getPassword') + ->willReturn('123456'); $user->expects($this->once()) ->method('setUsername') ->with('LmcUser'); @@ -159,13 +160,14 @@ public function testRegisterWithUsernameAndDisplayNameUserStateDisabled() */ public function testRegisterWithDefaultUserStateOfZero() { - $expectArray = array('username' => 'LmcUser', 'display_name' => 'Zfc User'); + $expectArray = array('username' => 'LmcUser', 'display_name' => 'Zfc User', 'password' => '123456'); $user = $this->createMock('LmcUser\Entity\User'); $user->expects($this->once()) ->method('setPassword'); $user->expects($this->once()) - ->method('getPassword'); + ->method('getPassword') + ->willReturn('123456'); $user->expects($this->once()) ->method('setUsername') ->with('LmcUser'); @@ -231,13 +233,14 @@ public function testRegisterWithDefaultUserStateOfZero() */ public function testRegisterWithUserStateDisabled() { - $expectArray = array('username' => 'LmcUser', 'display_name' => 'Zfc User'); + $expectArray = array('username' => 'LmcUser', 'display_name' => 'Zfc User', 'password' => '123456'); $user = $this->createMock('LmcUser\Entity\User'); $user->expects($this->once()) ->method('setPassword'); $user->expects($this->once()) - ->method('getPassword'); + ->method('getPassword') + ->willReturn('123456'); $user->expects($this->once()) ->method('setUsername') ->with('LmcUser');