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 2421787..0a5cc24 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 @@ -56,7 +56,7 @@ final class CountFollowersQueryHandlerTest extends TestCase ) ); - $expectedReponse = new CountFollowersResponse( + $expectedResponse = new CountFollowersResponse( authorId: $authorId, authorUsername: $authorUsername, numberOfFollowers: $authorFollowers @@ -67,23 +67,23 @@ 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 diff --git a/tests/Cheeper/Tests/Chapter6/Application/Author/Projection/CountFollowersProjectionHandlerTest.php b/tests/Cheeper/Tests/Chapter6/Application/Author/Projection/CountFollowersProjectionHandlerTest.php index fc021a1..2b25baa 100644 --- a/tests/Cheeper/Tests/Chapter6/Application/Author/Projection/CountFollowersProjectionHandlerTest.php +++ b/tests/Cheeper/Tests/Chapter6/Application/Author/Projection/CountFollowersProjectionHandlerTest.php @@ -54,16 +54,14 @@ final class CountFollowersProjectionHandlerTest extends TestCase $redisMock = $this->createMock(\Redis::class); $redisMock ->expects($this->once()) - ->method('set') + ->method('hmset') ->with( - 'author_followers_counter_projection:'.$authorId, - json_encode( - [ - 'id' => $authorId, - 'username' => $authorUsername, - 'followers' => $authorFollowers, - ] - ) + 'author_followers_counter_projection:'.$authorId, + [ + 'id' => $authorId, + 'username' => $authorUsername, + 'followers' => $authorFollowers, + ] ) ; diff --git a/tests/Cheeper/Tests/Chapter7/Application/Author/Projection/CountFollowersProjectionHandlerTest.php b/tests/Cheeper/Tests/Chapter7/Application/Author/Projection/CountFollowersProjectionHandlerTest.php index ed2ccab..82105b2 100644 --- a/tests/Cheeper/Tests/Chapter7/Application/Author/Projection/CountFollowersProjectionHandlerTest.php +++ b/tests/Cheeper/Tests/Chapter7/Application/Author/Projection/CountFollowersProjectionHandlerTest.php @@ -58,8 +58,8 @@ final class CountFollowersProjectionHandlerTest extends TestCase $redisMock = $this->createMock(\Redis::class); $redisMock ->expects($this->once()) - ->method('set') - ->with($redisKey, json_encode($redisRecord)); + ->method('hmset') + ->with($redisKey, $redisRecord); $dbMock = $this->buildEntityManagerMockReturning($redisRecord); diff --git a/tests/Cheeper/Tests/Chapter7/Application/Author/Projection/CreateFollowersCounterProjectionHandlerTest.php b/tests/Cheeper/Tests/Chapter7/Application/Author/Projection/CreateFollowersCounterProjectionHandlerTest.php index 6fd9867..04192ab 100644 --- a/tests/Cheeper/Tests/Chapter7/Application/Author/Projection/CreateFollowersCounterProjectionHandlerTest.php +++ b/tests/Cheeper/Tests/Chapter7/Application/Author/Projection/CreateFollowersCounterProjectionHandlerTest.php @@ -25,8 +25,8 @@ final class CreateFollowersCounterProjectionHandlerTest extends TestCase $redisMock = $this->createMock(\Redis::class); $redisMock ->expects($this->once()) - ->method('set') - ->with($redisKey, json_encode($redisRecord)); + ->method('hmset') + ->with($redisKey, $redisRecord); $handler = new CreateFollowersCounterProjectionHandler( $redisMock,