mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-12-22 23:46:10 +01:00
[CLEANUP] Replace "fixture" with "subject" in the unit tests.
This commit is contained in:
parent
ee93fac2b7
commit
4f245f1944
7 changed files with 71 additions and 71 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue