diff --git a/tests/Cheeper/Tests/Chapter5/Application/Author/Query/CountFollowersQueryHandler/WithRedisAccess/CountFollowersQueryHandlerTest.php b/tests/Cheeper/Tests/Chapter5/Application/Author/Query/CountFollowersQueryHandler/WithRedisAccess/CountFollowersQueryHandlerTest.php index 0a5cc24..ed63297 100644 --- a/tests/Cheeper/Tests/Chapter5/Application/Author/Query/CountFollowersQueryHandler/WithRedisAccess/CountFollowersQueryHandlerTest.php +++ b/tests/Cheeper/Tests/Chapter5/Application/Author/Query/CountFollowersQueryHandler/WithRedisAccess/CountFollowersQueryHandlerTest.php @@ -48,11 +48,11 @@ final class CountFollowersQueryHandlerTest extends TestCase $authorFollowers = 0; $queryHandler = new CountFollowersQueryHandler( $this->buildRedisMockReturning( - json_encode([ + [ 'id' => $authorId, 'username' => $authorUsername, 'followers' => $authorFollowers, - ]) + ] ) ); @@ -89,7 +89,7 @@ final class CountFollowersQueryHandlerTest extends TestCase private function buildRedisMockReturning($fakeReturn): Redis { $mock = $this->createStub(Redis::class); - $mock->method('get')->willReturn( + $mock->method('hGetAll')->willReturn( $fakeReturn ); diff --git a/tests/Cheeper/Tests/Chapter7/Application/Author/Query/CountFollowersQueryHandlerTest.php b/tests/Cheeper/Tests/Chapter7/Application/Author/Query/CountFollowersQueryHandlerTest.php index c315350..18170c4 100644 --- a/tests/Cheeper/Tests/Chapter7/Application/Author/Query/CountFollowersQueryHandlerTest.php +++ b/tests/Cheeper/Tests/Chapter7/Application/Author/Query/CountFollowersQueryHandlerTest.php @@ -48,15 +48,15 @@ final class CountFollowersQueryHandlerTest extends TestCase $authorFollowers = 0; $queryHandler = new CountFollowersQueryHandler( $this->buildRedisMockReturning( - json_encode([ + [ 'id' => $authorId, 'username' => $authorUsername, 'followers' => $authorFollowers, - ]) + ] ) ); - $expectedReponse = new CountFollowersResponse( + $expectedResponse = new CountFollowersResponse( authorId: $authorId, authorUsername: $authorUsername, numberOfFollowers: $authorFollowers @@ -67,29 +67,29 @@ final class CountFollowersQueryHandlerTest extends TestCase ); $this->assertSame( - $expectedReponse->authorId(), + $expectedResponse->authorId(), $actualResponse->authorId() ); $this->assertSame( - $expectedReponse->authorUsername(), + $expectedResponse->authorUsername(), $actualResponse->authorUsername() ); $this->assertSame( - $expectedReponse->numberOfFollowers(), + $expectedResponse->numberOfFollowers(), $actualResponse->numberOfFollowers() ); // In PHPUnit, there is also the chance to // compare the whole content of the object - // $this->assertEquals($expectedReponse, $actualResponse); + // $this->assertEquals($expectedResponse, $actualResponse); } private function buildRedisMockReturning($fakeReturn): Redis { $mock = $this->createStub(Redis::class); - $mock->method('get')->willReturn( + $mock->method('hGetAll')->willReturn( $fakeReturn );