From f2bfae5889328f48afc40f8578c9575cafd1946f Mon Sep 17 00:00:00 2001 From: jeroendedauw Date: Mon, 8 Feb 2016 11:15:10 +0100 Subject: [PATCH] Use publicRecord instead of name field for comment user name display --- src/DataAccess/DbalCommentRepository.php | 2 +- .../DataAccess/DbalCommentRepositoryTest.php | 10 +++++----- tests/System/Routes/ListCommentsHtmlRouteTest.php | 6 +++--- tests/System/Routes/ListCommentsJsonRouteTest.php | 4 ++-- tests/System/Routes/ListCommentsRssRouteTest.php | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/DataAccess/DbalCommentRepository.php b/src/DataAccess/DbalCommentRepository.php index ea3ea8d35..0242a6473 100644 --- a/src/DataAccess/DbalCommentRepository.php +++ b/src/DataAccess/DbalCommentRepository.php @@ -32,7 +32,7 @@ public function getPublicComments( int $limit ): array { return array_map( function( Donation $donation ) { return Comment::newInstance() - ->setAuthorName( $donation->getName() ) + ->setAuthorName( $donation->getPublicRecord() ) ->setCommentText( $donation->getComment() ) ->setDonationAmount( (float)$donation->getAmount() ) ->setPostingTime( $donation->getDtNew() ) diff --git a/tests/Integration/DataAccess/DbalCommentRepositoryTest.php b/tests/Integration/DataAccess/DbalCommentRepositoryTest.php index ce4fc0151..fb6e5e39e 100644 --- a/tests/Integration/DataAccess/DbalCommentRepositoryTest.php +++ b/tests/Integration/DataAccess/DbalCommentRepositoryTest.php @@ -114,7 +114,7 @@ public function testOnlyNonDeletedCommentsGetReturned() { private function persistFirstComment() { $firstDonation = new Donation(); - $firstDonation->setName( 'First name' ); + $firstDonation->setPublicRecord( 'First name' ); $firstDonation->setComment( 'First comment' ); $firstDonation->setAmount( '100' ); $firstDonation->setDtNew( new DateTime( '1984-01-01' ) ); @@ -124,7 +124,7 @@ private function persistFirstComment() { private function persistSecondComment() { $secondDonation = new Donation(); - $secondDonation->setName( 'Second name' ); + $secondDonation->setPublicRecord( 'Second name' ); $secondDonation->setComment( 'Second comment' ); $secondDonation->setAmount( '200' ); $secondDonation->setDtNew( new DateTime( '1984-02-02' ) ); @@ -134,7 +134,7 @@ private function persistSecondComment() { private function persistThirdComment() { $thirdDonation = new Donation(); - $thirdDonation->setName( 'Third name' ); + $thirdDonation->setPublicRecord( 'Third name' ); $thirdDonation->setComment( 'Third comment' ); $thirdDonation->setAmount( '300' ); $thirdDonation->setDtNew( new DateTime( '1984-03-03' ) ); @@ -144,7 +144,7 @@ private function persistThirdComment() { private function persistPrivateComment() { $privateDonation = new Donation(); - $privateDonation->setName( 'Private name' ); + $privateDonation->setPublicRecord( 'Private name' ); $privateDonation->setComment( 'Private comment' ); $privateDonation->setAmount( '1337' ); $privateDonation->setDtNew( new DateTime( '1984-12-12' ) ); @@ -154,7 +154,7 @@ private function persistPrivateComment() { private function persistDeletedComment() { $deletedDonation = new Donation(); - $deletedDonation->setName( 'Deleted name' ); + $deletedDonation->setPublicRecord( 'Deleted name' ); $deletedDonation->setComment( 'Deleted comment' ); $deletedDonation->setAmount( '31337' ); $deletedDonation->setDtNew( new DateTime( '1984-11-11' ) ); diff --git a/tests/System/Routes/ListCommentsHtmlRouteTest.php b/tests/System/Routes/ListCommentsHtmlRouteTest.php index c9cf563d3..3b48d88e5 100644 --- a/tests/System/Routes/ListCommentsHtmlRouteTest.php +++ b/tests/System/Routes/ListCommentsHtmlRouteTest.php @@ -51,7 +51,7 @@ private function newClientWithThreeComments(): Client { private function persistFirstComment( EntityManager $entityManager ) { $firstDonation = new Donation(); - $firstDonation->setName( 'First name' ); + $firstDonation->setPublicRecord( 'First name' ); $firstDonation->setComment( 'First comment' ); $firstDonation->setAmount( '100.42' ); $firstDonation->setDtNew( new DateTime( '1984-01-01' ) ); @@ -61,7 +61,7 @@ private function persistFirstComment( EntityManager $entityManager ) { private function persistSecondComment( EntityManager $entityManager ) { $secondDonation = new Donation(); - $secondDonation->setName( 'Second name' ); + $secondDonation->setPublicRecord( 'Second name' ); $secondDonation->setComment( 'Second comment' ); $secondDonation->setAmount( '9001' ); $secondDonation->setDtNew( new DateTime( '1984-02-02' ) ); @@ -71,7 +71,7 @@ private function persistSecondComment( EntityManager $entityManager ) { private function persistEvilComment( EntityManager $entityManager ) { $secondDonation = new Donation(); - $secondDonation->setName( 'Third name & company' ); + $secondDonation->setPublicRecord( 'Third name & company' ); $secondDonation->setComment( 'Third