/** * @test */ public function renderCreatesIconPathWithHtmlSpecialChars() { $extensionKey = 'phpunit'; $testable = new Tx_Phpunit_Testable(); $testable->setKey($extensionKey); $testable->setIconPath(ExtensionManagementUtility::extPath('phpunit') . 'ext_&_icon.gif'); $subject = new Tx_Phpunit_ViewHelpers_ExtensionSelectorViewHelper(); $subject->injectOutputService($this->outputService); $subject->injectUserSettingService($this->userSettingsService); /** @var $testFinder Tx_Phpunit_Service_TestFinder|PHPUnit_Framework_MockObject_MockObject */ $testFinder = $this->getMock('Tx_Phpunit_Service_TestFinder', array('getTestablesForEverything')); $testFinder->expects(self::any())->method('getTestablesForEverything')->will(self::returnValue(array($extensionKey => $testable))); $subject->injectTestFinder($testFinder); $subject->render(); self::assertContains(htmlspecialchars($testable->getIconPath()), $this->outputService->getCollectedOutput()); }
/** * @test */ public function getTestablesForExtensionsSortsExtensionsByNsmeInAscendingOrder() { $testableForFoo = new Tx_Phpunit_Testable(); $testableForFoo->setKey('foo'); $testableForBar = new Tx_Phpunit_Testable(); $testableForBar->setKey('bar'); /** @var $testFinder Tx_Phpunit_Service_TestFinder|PHPUnit_Framework_MockObject_MockObject */ $testFinder = $this->getMock('Tx_Phpunit_Service_TestFinder', array('getLoadedExtensionKeys', 'getExcludedExtensionKeys', 'findTestsPathForExtension', 'createTestableForSingleExtension')); $testFinder->expects($this->once())->method('getLoadedExtensionKeys')->will($this->returnValue(array('foo', 'bar'))); $testFinder->expects($this->once())->method('getExcludedExtensionKeys')->will($this->returnValue(array())); $testFinder->expects($this->at(2))->method('createTestableForSingleExtension')->with('foo')->will($this->returnValue($testableForFoo)); $testFinder->expects($this->at(3))->method('createTestableForSingleExtension')->with('bar')->will($this->returnValue($testableForBar)); $this->assertSame(array('bar' => $testableForBar, 'foo' => $testableForFoo), $testFinder->getTestablesForExtensions()); }
/** * @test * * @expectedException InvalidArgumentException */ public function setKeyWithEmptyStringThrowsException() { $this->fixture->setKey(''); }
/** * @test * * @expectedException InvalidArgumentException */ public function setKeyWithEmptyStringThrowsException() { $this->subject->setKey(''); }