From 4f245f19440ebaf4bdafe75ac8d32e7551f2a719 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Mon, 11 Nov 2013 11:50:25 +0100 Subject: [PATCH] [CLEANUP] Replace "fixture" with "subject" in the unit tests. --- .../Controller/TestimonialControllerTest.php | 14 ++--- Tests/Unit/Domain/Model/AdditionTest.php | 12 ++-- Tests/Unit/Domain/Model/TeaBeverageTest.php | 58 +++++++++---------- Tests/Unit/Domain/Model/TeaTypeTest.php | 18 +++--- Tests/Unit/Domain/Model/TestimonialTest.php | 24 ++++---- .../Repository/TeaBeverageRepositoryTest.php | 8 +-- .../Repository/TestimonialRepositoryTest.php | 8 +-- 7 files changed, 71 insertions(+), 71 deletions(-) diff --git a/Tests/Unit/Controller/TestimonialControllerTest.php b/Tests/Unit/Controller/TestimonialControllerTest.php index d4da0e0..556d8e6 100644 --- a/Tests/Unit/Controller/TestimonialControllerTest.php +++ b/Tests/Unit/Controller/TestimonialControllerTest.php @@ -40,7 +40,7 @@ class TestimonialControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa /** * @var TestimonialController */ - protected $fixture; + protected $subject; /** * @var ViewInterface @@ -53,26 +53,26 @@ class TestimonialControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa protected $testimonialRepository = NULL; public function setUp() { - $this->fixture = new TestimonialController(); + $this->subject = new TestimonialController(); $this->view = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\View\\ViewInterface'); - $this->fixture->setView($this->view); + $this->subject->setView($this->view); $this->testimonialRepository = $this->getMock( 'OliverKlee\\Tea\\Domain\\Repository\\TestimonialRepository', array(), array(), '', FALSE ); - $this->fixture->injectTestimonialRepository($this->testimonialRepository); + $this->subject->injectTestimonialRepository($this->testimonialRepository); } public function tearDown() { - unset($this->fixture, $this->view, $this->testimonialRepository); + unset($this->subject, $this->view, $this->testimonialRepository); } /** * @test */ public function indexActionCanBeCalled() { - $this->fixture->indexAction(); + $this->subject->indexAction(); } /** @@ -85,7 +85,7 @@ class TestimonialControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa $this->view->expects($this->once())->method('assign')->with('testimonials', $allTestimonials); - $this->fixture->indexAction(); + $this->subject->indexAction(); } } ?> \ No newline at end of file diff --git a/Tests/Unit/Domain/Model/AdditionTest.php b/Tests/Unit/Domain/Model/AdditionTest.php index 70a349d..672013f 100644 --- a/Tests/Unit/Domain/Model/AdditionTest.php +++ b/Tests/Unit/Domain/Model/AdditionTest.php @@ -34,14 +34,14 @@ class AdditionTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { /** * @var \OliverKlee\Tea\Domain\Model\Addition */ - protected $fixture = NULL; + protected $subject = NULL; public function setUp() { - $this->fixture = new \OliverKlee\Tea\Domain\Model\Addition(); + $this->subject = new \OliverKlee\Tea\Domain\Model\Addition(); } public function tearDown() { - unset($this->fixture); + unset($this->subject); } /** @@ -50,7 +50,7 @@ class AdditionTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { public function getTitleInitiallyReturnsEmptyString() { $this->assertSame( '', - $this->fixture->getTitle() + $this->subject->getTitle() ); } @@ -58,11 +58,11 @@ class AdditionTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { * @test */ public function setTitleSetsTitle() { - $this->fixture->setTitle('foo bar'); + $this->subject->setTitle('foo bar'); $this->assertSame( 'foo bar', - $this->fixture->getTitle() + $this->subject->getTitle() ); } } diff --git a/Tests/Unit/Domain/Model/TeaBeverageTest.php b/Tests/Unit/Domain/Model/TeaBeverageTest.php index cb43508..f921208 100644 --- a/Tests/Unit/Domain/Model/TeaBeverageTest.php +++ b/Tests/Unit/Domain/Model/TeaBeverageTest.php @@ -34,14 +34,14 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { /** * @var \OliverKlee\Tea\Domain\Model\TeaBeverage */ - protected $fixture = NULL; + protected $subject = NULL; public function setUp() { - $this->fixture = new \OliverKlee\Tea\Domain\Model\TeaBeverage(); + $this->subject = new \OliverKlee\Tea\Domain\Model\TeaBeverage(); } public function tearDown() { - unset($this->fixture); + unset($this->subject); } /** @@ -50,7 +50,7 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { public function getSizeInitiallyReturnsZero() { $this->assertSame( 0.0, - $this->fixture->getSize() + $this->subject->getSize() ); } @@ -58,11 +58,11 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { * @test */ public function setSizeSetsSize() { - $this->fixture->setSize(1234.56); + $this->subject->setSize(1234.56); $this->assertSame( 1234.56, - $this->fixture->getSize() + $this->subject->getSize() ); } @@ -71,7 +71,7 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { */ public function getTypeInitiallyReturnsNull() { $this->assertNull( - $this->fixture->getType() + $this->subject->getType() ); } @@ -80,11 +80,11 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { */ public function setTypeSetsType() { $type = new \OliverKlee\Tea\Domain\Model\TeaType(); - $this->fixture->setType($type); + $this->subject->setType($type); $this->assertSame( $type, - $this->fixture->getType() + $this->subject->getType() ); } @@ -94,7 +94,7 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { public function getAdditionsInitiallyReturnsEmptyStorage() { $this->assertEquals( new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(), - $this->fixture->getAdditions() + $this->subject->getAdditions() ); } @@ -103,11 +103,11 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { */ public function setAdditionsSetsAdditions() { $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->fixture->setAdditions($items); + $this->subject->setAdditions($items); $this->assertSame( $items, - $this->fixture->getAdditions() + $this->subject->getAdditions() ); } @@ -116,13 +116,13 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { */ public function addAdditionAddsAddition() { $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->fixture->setAdditions($items); + $this->subject->setAdditions($items); $newItem = new \OliverKlee\Tea\Domain\Model\Addition(); - $this->fixture->addAddition($newItem); + $this->subject->addAddition($newItem); $this->assertTrue( - $this->fixture->getAdditions()->contains($newItem) + $this->subject->getAdditions()->contains($newItem) ); } @@ -131,14 +131,14 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { */ public function removeAdditionRemovesAddition() { $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->fixture->setAdditions($items); + $this->subject->setAdditions($items); $newItem = new \OliverKlee\Tea\Domain\Model\Addition(); - $this->fixture->addAddition($newItem); - $this->fixture->removeAddition($newItem); + $this->subject->addAddition($newItem); + $this->subject->removeAddition($newItem); $this->assertFalse( - $this->fixture->getAdditions()->contains($newItem) + $this->subject->getAdditions()->contains($newItem) ); } @@ -148,7 +148,7 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { public function getTestimonialsInitiallyReturnsEmptyStorage() { $this->assertEquals( new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(), - $this->fixture->getTestimonials() + $this->subject->getTestimonials() ); } @@ -157,11 +157,11 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { */ public function setTestimonialsSetsTestimonials() { $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->fixture->setTestimonials($items); + $this->subject->setTestimonials($items); $this->assertSame( $items, - $this->fixture->getTestimonials() + $this->subject->getTestimonials() ); } @@ -170,13 +170,13 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { */ public function addTestimonialAddsTestimonial() { $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->fixture->setTestimonials($items); + $this->subject->setTestimonials($items); $newItem = new \OliverKlee\Tea\Domain\Model\Testimonial(); - $this->fixture->addTestimonial($newItem); + $this->subject->addTestimonial($newItem); $this->assertTrue( - $this->fixture->getTestimonials()->contains($newItem) + $this->subject->getTestimonials()->contains($newItem) ); } @@ -185,14 +185,14 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { */ public function removeTestimonialRemovesTestimonial() { $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); - $this->fixture->setTestimonials($items); + $this->subject->setTestimonials($items); $newItem = new \OliverKlee\Tea\Domain\Model\Testimonial(); - $this->fixture->addTestimonial($newItem); - $this->fixture->removeTestimonial($newItem); + $this->subject->addTestimonial($newItem); + $this->subject->removeTestimonial($newItem); $this->assertFalse( - $this->fixture->getTestimonials()->contains($newItem) + $this->subject->getTestimonials()->contains($newItem) ); } } diff --git a/Tests/Unit/Domain/Model/TeaTypeTest.php b/Tests/Unit/Domain/Model/TeaTypeTest.php index f6ddba8..90ce009 100644 --- a/Tests/Unit/Domain/Model/TeaTypeTest.php +++ b/Tests/Unit/Domain/Model/TeaTypeTest.php @@ -34,14 +34,14 @@ class TeaTypeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { /** * @var \OliverKlee\Tea\Domain\Model\TeaType */ - protected $fixture = NULL; + protected $subject = NULL; public function setUp() { - $this->fixture = new \OliverKlee\Tea\Domain\Model\TeaType(); + $this->subject = new \OliverKlee\Tea\Domain\Model\TeaType(); } public function tearDown() { - unset($this->fixture); + unset($this->subject); } /** @@ -50,7 +50,7 @@ class TeaTypeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { public function getTitleInitiallyReturnsEmptyString() { $this->assertSame( '', - $this->fixture->getTitle() + $this->subject->getTitle() ); } @@ -58,11 +58,11 @@ class TeaTypeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { * @test */ public function setTitleSetsTitle() { - $this->fixture->setTitle('foo bar'); + $this->subject->setTitle('foo bar'); $this->assertSame( 'foo bar', - $this->fixture->getTitle() + $this->subject->getTitle() ); } @@ -72,7 +72,7 @@ class TeaTypeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { public function getCaffeinatedInitiallyReturnsFalse() { $this->assertSame( FALSE, - $this->fixture->getCaffeinated() + $this->subject->getCaffeinated() ); } @@ -80,10 +80,10 @@ class TeaTypeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { * @test */ public function setCaffeinatedSetsCaffeinated() { - $this->fixture->setCaffeinated(TRUE); + $this->subject->setCaffeinated(TRUE); $this->assertSame( TRUE, - $this->fixture->getCaffeinated() + $this->subject->getCaffeinated() ); } } diff --git a/Tests/Unit/Domain/Model/TestimonialTest.php b/Tests/Unit/Domain/Model/TestimonialTest.php index 337c0f8..834682b 100644 --- a/Tests/Unit/Domain/Model/TestimonialTest.php +++ b/Tests/Unit/Domain/Model/TestimonialTest.php @@ -34,14 +34,14 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { /** * @var \OliverKlee\Tea\Domain\Model\Testimonial */ - protected $fixture = NULL; + protected $subject = NULL; public function setUp() { - $this->fixture = new \OliverKlee\Tea\Domain\Model\Testimonial(); + $this->subject = new \OliverKlee\Tea\Domain\Model\Testimonial(); } public function tearDown() { - unset($this->fixture); + unset($this->subject); } /** @@ -49,7 +49,7 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { */ public function getDateOfPostingInitiallyReturnsNull() { $this->assertNull( - $this->fixture->getDateOfPosting() + $this->subject->getDateOfPosting() ); } @@ -58,11 +58,11 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { */ public function setDateOfPostingSetsDateOfPosting() { $date = new \DateTime(); - $this->fixture->setDateOfPosting($date); + $this->subject->setDateOfPosting($date); $this->assertSame( $date, - $this->fixture->getDateOfPosting() + $this->subject->getDateOfPosting() ); } @@ -72,7 +72,7 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { public function getNumberOfConsumedCupsInitiallyReturnsZero() { $this->assertSame( 0, - $this->fixture->getNumberOfConsumedCups() + $this->subject->getNumberOfConsumedCups() ); } @@ -80,11 +80,11 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { * @test */ public function setNumberOfConsumedCupsSetsNumberOfConsumedCups() { - $this->fixture->setNumberOfConsumedCups(123456); + $this->subject->setNumberOfConsumedCups(123456); $this->assertSame( 123456, - $this->fixture->getNumberOfConsumedCups() + $this->subject->getNumberOfConsumedCups() ); } @@ -94,7 +94,7 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { public function getTextInitiallyReturnsEmptyString() { $this->assertSame( '', - $this->fixture->getText() + $this->subject->getText() ); } @@ -102,11 +102,11 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { * @test */ public function setTextSetsText() { - $this->fixture->setText('foo bar'); + $this->subject->setText('foo bar'); $this->assertSame( 'foo bar', - $this->fixture->getText() + $this->subject->getText() ); } } diff --git a/Tests/Unit/Domain/Repository/TeaBeverageRepositoryTest.php b/Tests/Unit/Domain/Repository/TeaBeverageRepositoryTest.php index c1bc6b3..89998c0 100644 --- a/Tests/Unit/Domain/Repository/TeaBeverageRepositoryTest.php +++ b/Tests/Unit/Domain/Repository/TeaBeverageRepositoryTest.php @@ -34,7 +34,7 @@ class TeaBeverageRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa /** * @var \OliverKlee\Tea\Domain\Model\TeaBeverage */ - protected $fixture; + protected $subject; /** * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|PHPUnit_Framework_MockObject_MockObject @@ -44,11 +44,11 @@ class TeaBeverageRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa public function setUp() { $this->objectManager = $this->getMock('TYPO3\CMS\Extbase\Object\ObjectManagerInterface'); - $this->fixture = new \OliverKlee\Tea\Domain\Repository\TeaBeverageRepository($this->objectManager); + $this->subject = new \OliverKlee\Tea\Domain\Repository\TeaBeverageRepository($this->objectManager); } public function tearDown() { - unset($this->fixture, $this->objectManager); + unset($this->subject, $this->objectManager); } /** @@ -56,7 +56,7 @@ class TeaBeverageRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa */ public function canBeInstantiated() { $this->assertNotNull( - $this->fixture + $this->subject ); } } diff --git a/Tests/Unit/Domain/Repository/TestimonialRepositoryTest.php b/Tests/Unit/Domain/Repository/TestimonialRepositoryTest.php index ae5b24f..17c2987 100644 --- a/Tests/Unit/Domain/Repository/TestimonialRepositoryTest.php +++ b/Tests/Unit/Domain/Repository/TestimonialRepositoryTest.php @@ -34,7 +34,7 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa /** * @var \OliverKlee\Tea\Domain\Model\Testimonial */ - protected $fixture; + protected $subject; /** * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|PHPUnit_Framework_MockObject_MockObject @@ -44,11 +44,11 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa public function setUp() { $this->objectManager = $this->getMock('TYPO3\CMS\Extbase\Object\ObjectManagerInterface'); - $this->fixture = new \OliverKlee\Tea\Domain\Repository\TestimonialRepository($this->objectManager); + $this->subject = new \OliverKlee\Tea\Domain\Repository\TestimonialRepository($this->objectManager); } public function tearDown() { - unset($this->fixture, $this->objectManager); + unset($this->subject, $this->objectManager); } /** @@ -56,7 +56,7 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa */ public function canBeInstantiated() { $this->assertNotNull( - $this->fixture + $this->subject ); } }