, Hermann Telser * * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is * free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * The GNU General Public License can be found at * http://www.gnu.org/copyleft/gpl.html. * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ /** * Test case for class HermannTelser\Zuladungsliste\Controller\WettbewerbeController. * * @author Hermann Telser */ class ExtrasperrungController extends \TYPO3\CMS\Core\Tests\UnitTestCase { /** * @var \HermannTelser\Zuladungsliste\Controller\WettbewerbeController */ protected $subject = NULL; public function setUp() { $this->subject = $this->getMock('HermannTelser\Zuladungsliste\Controller\WettbewerbeController', array('redirect', 'forward', 'addFlashMessage'), array(), '', FALSE); } public function tearDown() { unset($this->subject); } /** * @test */ public function listActionFetchesAllWettbewerbesFromRepositoryAndAssignsThemToView() { $allWettbewerbes = $this->getMock('TYPO3\CMS\Extbase\Persistence\ObjectStorage', array(), array(), '', FALSE); $wettbewerbeRepository = $this->getMock('HermannTelser\Zuladungsliste\Domain\Repository\WettbewerbeRepository', array('findAll'), array(), '', FALSE); $wettbewerbeRepository->expects($this->once())->method('findAll')->will($this->returnValue($allWettbewerbes)); $this->inject($this->subject, 'wettbewerbeRepository', $wettbewerbeRepository); $view = $this->getMock('TYPO3\CMS\Extbase\Mvc\View\ViewInterface'); $view->expects($this->once())->method('assign')->with('wettbewerbes', $allWettbewerbes); $this->inject($this->subject, 'view', $view); $this->subject->listAction(); } /** * @test */ public function showActionAssignsTheGivenWettbewerbeToView() { $wettbewerbe = new \HermannTelser\Zuladungsliste\Domain\Model\Wettbewerbe(); $view = $this->getMock('TYPO3\CMS\Extbase\Mvc\View\ViewInterface'); $this->inject($this->subject, 'view', $view); $view->expects($this->once())->method('assign')->with('wettbewerbe', $wettbewerbe); $this->subject->showAction($wettbewerbe); } /** * @test */ public function createActionAddsTheGivenWettbewerbeToWettbewerbeRepository() { $wettbewerbe = new \HermannTelser\Zuladungsliste\Domain\Model\Wettbewerbe(); $wettbewerbeRepository = $this->getMock('HermannTelser\Zuladungsliste\Domain\Repository\WettbewerbeRepository', array('add'), array(), '', FALSE); $wettbewerbeRepository->expects($this->once())->method('add')->with($wettbewerbe); $this->inject($this->subject, 'wettbewerbeRepository', $wettbewerbeRepository); $this->subject->createAction($wettbewerbe); } /** * @test */ public function editActionAssignsTheGivenWettbewerbeToView() { $wettbewerbe = new \HermannTelser\Zuladungsliste\Domain\Model\Wettbewerbe(); $view = $this->getMock('TYPO3\CMS\Extbase\Mvc\View\ViewInterface'); $this->inject($this->subject, 'view', $view); $view->expects($this->once())->method('assign')->with('wettbewerbe', $wettbewerbe); $this->subject->editAction($wettbewerbe); } /** * @test */ public function updateActionUpdatesTheGivenWettbewerbeInWettbewerbeRepository() { $wettbewerbe = new \HermannTelser\Zuladungsliste\Domain\Model\Wettbewerbe(); $wettbewerbeRepository = $this->getMock('HermannTelser\Zuladungsliste\Domain\Repository\WettbewerbeRepository', array('update'), array(), '', FALSE); $wettbewerbeRepository->expects($this->once())->method('update')->with($wettbewerbe); $this->inject($this->subject, 'wettbewerbeRepository', $wettbewerbeRepository); $this->subject->updateAction($wettbewerbe); } /** * @test */ public function deleteActionRemovesTheGivenWettbewerbeFromWettbewerbeRepository() { $wettbewerbe = new \HermannTelser\Zuladungsliste\Domain\Model\Wettbewerbe(); $wettbewerbeRepository = $this->getMock('HermannTelser\Zuladungsliste\Domain\Repository\WettbewerbeRepository', array('remove'), array(), '', FALSE); $wettbewerbeRepository->expects($this->once())->method('remove')->with($wettbewerbe); $this->inject($this->subject, 'wettbewerbeRepository', $wettbewerbeRepository); $this->subject->deleteAction($wettbewerbe); } /** * action * * @return void */ public function Action() { } }