mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-22 19:36:12 +01:00

[CLEANUP] Replace "fixture" with "subject" in the unit tests.

This commit is contained in:
Oliver Klee 2013-11-11 11:50:25 +01:00
parent ee93fac2b7
commit 4f245f1944
7 changed files with 71 additions and 71 deletions

View file

@ -40,7 +40,7 @@ class TestimonialControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
/** /**
* @var TestimonialController * @var TestimonialController
*/ */
protected $fixture; protected $subject;
/** /**
* @var ViewInterface * @var ViewInterface
@ -53,26 +53,26 @@ class TestimonialControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
protected $testimonialRepository = NULL; protected $testimonialRepository = NULL;
public function setUp() { public function setUp() {
$this->fixture = new TestimonialController(); $this->subject = new TestimonialController();
$this->view = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\View\\ViewInterface'); $this->view = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\View\\ViewInterface');
$this->fixture->setView($this->view); $this->subject->setView($this->view);
$this->testimonialRepository = $this->getMock( $this->testimonialRepository = $this->getMock(
'OliverKlee\\Tea\\Domain\\Repository\\TestimonialRepository', array(), array(), '', FALSE 'OliverKlee\\Tea\\Domain\\Repository\\TestimonialRepository', array(), array(), '', FALSE
); );
$this->fixture->injectTestimonialRepository($this->testimonialRepository); $this->subject->injectTestimonialRepository($this->testimonialRepository);
} }
public function tearDown() { public function tearDown() {
unset($this->fixture, $this->view, $this->testimonialRepository); unset($this->subject, $this->view, $this->testimonialRepository);
} }
/** /**
* @test * @test
*/ */
public function indexActionCanBeCalled() { 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->view->expects($this->once())->method('assign')->with('testimonials', $allTestimonials);
$this->fixture->indexAction(); $this->subject->indexAction();
} }
} }
?> ?>

View file

@ -34,14 +34,14 @@ class AdditionTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
/** /**
* @var \OliverKlee\Tea\Domain\Model\Addition * @var \OliverKlee\Tea\Domain\Model\Addition
*/ */
protected $fixture = NULL; protected $subject = NULL;
public function setUp() { public function setUp() {
$this->fixture = new \OliverKlee\Tea\Domain\Model\Addition(); $this->subject = new \OliverKlee\Tea\Domain\Model\Addition();
} }
public function tearDown() { 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() { public function getTitleInitiallyReturnsEmptyString() {
$this->assertSame( $this->assertSame(
'', '',
$this->fixture->getTitle() $this->subject->getTitle()
); );
} }
@ -58,11 +58,11 @@ class AdditionTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
* @test * @test
*/ */
public function setTitleSetsTitle() { public function setTitleSetsTitle() {
$this->fixture->setTitle('foo bar'); $this->subject->setTitle('foo bar');
$this->assertSame( $this->assertSame(
'foo bar', 'foo bar',
$this->fixture->getTitle() $this->subject->getTitle()
); );
} }
} }

View file

@ -34,14 +34,14 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
/** /**
* @var \OliverKlee\Tea\Domain\Model\TeaBeverage * @var \OliverKlee\Tea\Domain\Model\TeaBeverage
*/ */
protected $fixture = NULL; protected $subject = NULL;
public function setUp() { public function setUp() {
$this->fixture = new \OliverKlee\Tea\Domain\Model\TeaBeverage(); $this->subject = new \OliverKlee\Tea\Domain\Model\TeaBeverage();
} }
public function tearDown() { 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() { public function getSizeInitiallyReturnsZero() {
$this->assertSame( $this->assertSame(
0.0, 0.0,
$this->fixture->getSize() $this->subject->getSize()
); );
} }
@ -58,11 +58,11 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
* @test * @test
*/ */
public function setSizeSetsSize() { public function setSizeSetsSize() {
$this->fixture->setSize(1234.56); $this->subject->setSize(1234.56);
$this->assertSame( $this->assertSame(
1234.56, 1234.56,
$this->fixture->getSize() $this->subject->getSize()
); );
} }
@ -71,7 +71,7 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
*/ */
public function getTypeInitiallyReturnsNull() { public function getTypeInitiallyReturnsNull() {
$this->assertNull( $this->assertNull(
$this->fixture->getType() $this->subject->getType()
); );
} }
@ -80,11 +80,11 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
*/ */
public function setTypeSetsType() { public function setTypeSetsType() {
$type = new \OliverKlee\Tea\Domain\Model\TeaType(); $type = new \OliverKlee\Tea\Domain\Model\TeaType();
$this->fixture->setType($type); $this->subject->setType($type);
$this->assertSame( $this->assertSame(
$type, $type,
$this->fixture->getType() $this->subject->getType()
); );
} }
@ -94,7 +94,7 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
public function getAdditionsInitiallyReturnsEmptyStorage() { public function getAdditionsInitiallyReturnsEmptyStorage() {
$this->assertEquals( $this->assertEquals(
new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(), 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() { public function setAdditionsSetsAdditions() {
$items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->fixture->setAdditions($items); $this->subject->setAdditions($items);
$this->assertSame( $this->assertSame(
$items, $items,
$this->fixture->getAdditions() $this->subject->getAdditions()
); );
} }
@ -116,13 +116,13 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
*/ */
public function addAdditionAddsAddition() { public function addAdditionAddsAddition() {
$items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->fixture->setAdditions($items); $this->subject->setAdditions($items);
$newItem = new \OliverKlee\Tea\Domain\Model\Addition(); $newItem = new \OliverKlee\Tea\Domain\Model\Addition();
$this->fixture->addAddition($newItem); $this->subject->addAddition($newItem);
$this->assertTrue( $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() { public function removeAdditionRemovesAddition() {
$items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->fixture->setAdditions($items); $this->subject->setAdditions($items);
$newItem = new \OliverKlee\Tea\Domain\Model\Addition(); $newItem = new \OliverKlee\Tea\Domain\Model\Addition();
$this->fixture->addAddition($newItem); $this->subject->addAddition($newItem);
$this->fixture->removeAddition($newItem); $this->subject->removeAddition($newItem);
$this->assertFalse( $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() { public function getTestimonialsInitiallyReturnsEmptyStorage() {
$this->assertEquals( $this->assertEquals(
new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(), 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() { public function setTestimonialsSetsTestimonials() {
$items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->fixture->setTestimonials($items); $this->subject->setTestimonials($items);
$this->assertSame( $this->assertSame(
$items, $items,
$this->fixture->getTestimonials() $this->subject->getTestimonials()
); );
} }
@ -170,13 +170,13 @@ class TeaBeverageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
*/ */
public function addTestimonialAddsTestimonial() { public function addTestimonialAddsTestimonial() {
$items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->fixture->setTestimonials($items); $this->subject->setTestimonials($items);
$newItem = new \OliverKlee\Tea\Domain\Model\Testimonial(); $newItem = new \OliverKlee\Tea\Domain\Model\Testimonial();
$this->fixture->addTestimonial($newItem); $this->subject->addTestimonial($newItem);
$this->assertTrue( $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() { public function removeTestimonialRemovesTestimonial() {
$items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $items = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->fixture->setTestimonials($items); $this->subject->setTestimonials($items);
$newItem = new \OliverKlee\Tea\Domain\Model\Testimonial(); $newItem = new \OliverKlee\Tea\Domain\Model\Testimonial();
$this->fixture->addTestimonial($newItem); $this->subject->addTestimonial($newItem);
$this->fixture->removeTestimonial($newItem); $this->subject->removeTestimonial($newItem);
$this->assertFalse( $this->assertFalse(
$this->fixture->getTestimonials()->contains($newItem) $this->subject->getTestimonials()->contains($newItem)
); );
} }
} }

View file

@ -34,14 +34,14 @@ class TeaTypeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
/** /**
* @var \OliverKlee\Tea\Domain\Model\TeaType * @var \OliverKlee\Tea\Domain\Model\TeaType
*/ */
protected $fixture = NULL; protected $subject = NULL;
public function setUp() { public function setUp() {
$this->fixture = new \OliverKlee\Tea\Domain\Model\TeaType(); $this->subject = new \OliverKlee\Tea\Domain\Model\TeaType();
} }
public function tearDown() { 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() { public function getTitleInitiallyReturnsEmptyString() {
$this->assertSame( $this->assertSame(
'', '',
$this->fixture->getTitle() $this->subject->getTitle()
); );
} }
@ -58,11 +58,11 @@ class TeaTypeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
* @test * @test
*/ */
public function setTitleSetsTitle() { public function setTitleSetsTitle() {
$this->fixture->setTitle('foo bar'); $this->subject->setTitle('foo bar');
$this->assertSame( $this->assertSame(
'foo bar', 'foo bar',
$this->fixture->getTitle() $this->subject->getTitle()
); );
} }
@ -72,7 +72,7 @@ class TeaTypeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
public function getCaffeinatedInitiallyReturnsFalse() { public function getCaffeinatedInitiallyReturnsFalse() {
$this->assertSame( $this->assertSame(
FALSE, FALSE,
$this->fixture->getCaffeinated() $this->subject->getCaffeinated()
); );
} }
@ -80,10 +80,10 @@ class TeaTypeTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
* @test * @test
*/ */
public function setCaffeinatedSetsCaffeinated() { public function setCaffeinatedSetsCaffeinated() {
$this->fixture->setCaffeinated(TRUE); $this->subject->setCaffeinated(TRUE);
$this->assertSame( $this->assertSame(
TRUE, TRUE,
$this->fixture->getCaffeinated() $this->subject->getCaffeinated()
); );
} }
} }

View file

@ -34,14 +34,14 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
/** /**
* @var \OliverKlee\Tea\Domain\Model\Testimonial * @var \OliverKlee\Tea\Domain\Model\Testimonial
*/ */
protected $fixture = NULL; protected $subject = NULL;
public function setUp() { public function setUp() {
$this->fixture = new \OliverKlee\Tea\Domain\Model\Testimonial(); $this->subject = new \OliverKlee\Tea\Domain\Model\Testimonial();
} }
public function tearDown() { 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() { public function getDateOfPostingInitiallyReturnsNull() {
$this->assertNull( $this->assertNull(
$this->fixture->getDateOfPosting() $this->subject->getDateOfPosting()
); );
} }
@ -58,11 +58,11 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
*/ */
public function setDateOfPostingSetsDateOfPosting() { public function setDateOfPostingSetsDateOfPosting() {
$date = new \DateTime(); $date = new \DateTime();
$this->fixture->setDateOfPosting($date); $this->subject->setDateOfPosting($date);
$this->assertSame( $this->assertSame(
$date, $date,
$this->fixture->getDateOfPosting() $this->subject->getDateOfPosting()
); );
} }
@ -72,7 +72,7 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
public function getNumberOfConsumedCupsInitiallyReturnsZero() { public function getNumberOfConsumedCupsInitiallyReturnsZero() {
$this->assertSame( $this->assertSame(
0, 0,
$this->fixture->getNumberOfConsumedCups() $this->subject->getNumberOfConsumedCups()
); );
} }
@ -80,11 +80,11 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
* @test * @test
*/ */
public function setNumberOfConsumedCupsSetsNumberOfConsumedCups() { public function setNumberOfConsumedCupsSetsNumberOfConsumedCups() {
$this->fixture->setNumberOfConsumedCups(123456); $this->subject->setNumberOfConsumedCups(123456);
$this->assertSame( $this->assertSame(
123456, 123456,
$this->fixture->getNumberOfConsumedCups() $this->subject->getNumberOfConsumedCups()
); );
} }
@ -94,7 +94,7 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
public function getTextInitiallyReturnsEmptyString() { public function getTextInitiallyReturnsEmptyString() {
$this->assertSame( $this->assertSame(
'', '',
$this->fixture->getText() $this->subject->getText()
); );
} }
@ -102,11 +102,11 @@ class TestimonialTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
* @test * @test
*/ */
public function setTextSetsText() { public function setTextSetsText() {
$this->fixture->setText('foo bar'); $this->subject->setText('foo bar');
$this->assertSame( $this->assertSame(
'foo bar', 'foo bar',
$this->fixture->getText() $this->subject->getText()
); );
} }
} }

View file

@ -34,7 +34,7 @@ class TeaBeverageRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
/** /**
* @var \OliverKlee\Tea\Domain\Model\TeaBeverage * @var \OliverKlee\Tea\Domain\Model\TeaBeverage
*/ */
protected $fixture; protected $subject;
/** /**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|PHPUnit_Framework_MockObject_MockObject * @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() { public function setUp() {
$this->objectManager = $this->getMock('TYPO3\CMS\Extbase\Object\ObjectManagerInterface'); $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() { 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() { public function canBeInstantiated() {
$this->assertNotNull( $this->assertNotNull(
$this->fixture $this->subject
); );
} }
} }

View file

@ -34,7 +34,7 @@ class TestimonialRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCa
/** /**
* @var \OliverKlee\Tea\Domain\Model\Testimonial * @var \OliverKlee\Tea\Domain\Model\Testimonial
*/ */
protected $fixture; protected $subject;
/** /**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface|PHPUnit_Framework_MockObject_MockObject * @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() { public function setUp() {
$this->objectManager = $this->getMock('TYPO3\CMS\Extbase\Object\ObjectManagerInterface'); $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() { 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() { public function canBeInstantiated() {
$this->assertNotNull( $this->assertNotNull(
$this->fixture $this->subject
); );
} }
} }