protected function setUp() { $this->subject = new Tx_Phpunit_ViewHelpers_ExtensionSelectorViewHelper(); $this->outputService = new Tx_Phpunit_Service_FakeOutputService(); $this->subject->injectOutputService($this->outputService); $this->extensionSettingsService = new Tx_Phpunit_TestingDataContainer(); $this->testFinder = new Tx_Phpunit_Service_TestFinder(); $this->testFinder->injectExtensionSettingsService($this->extensionSettingsService); $this->subject->injectTestFinder($this->testFinder); $this->userSettingsService = new Tx_Phpunit_TestingDataContainer(); $this->subject->injectUserSettingService($this->userSettingsService); }
/** * @test * * Note: This tests uses a lowercase compare because some systems use a * case-insensitive file system. */ public function findTestsPathForExtensionForExtensionWithLowerCaseTestsDirectoryReturnsThatDirectory() { if (!t3lib_extMgm::isLoaded('bbb')) { $this->markTestSkipped('This test can only be run if the extension "bbb" from Tests/Unit/Fixtures/Extensions/ is installed.'); } $this->assertSame(strtolower(t3lib_extMgm::extPath('bbb') . 'tests/'), strtolower($this->fixture->findTestsPathForExtension('bbb'))); }
protected function setUp() { $this->backEndUserBackup = $GLOBALS['BE_USER']; $this->getLanguageService()->includeLLFile('EXT:phpunit/Resources/Private/Language/locallang_backend.xlf'); $subjectClassName = $this->createAccessibleProxy(); $this->subject = new $subjectClassName(); $this->request = new Tx_Phpunit_TestingDataContainer(); $this->subject->injectRequest($this->request); $this->outputService = new Tx_Phpunit_Service_FakeOutputService(); $this->subject->injectOutputService($this->outputService); $this->userSettingsService = new Tx_Phpunit_TestingDataContainer(); $this->subject->injectUserSettingsService($this->userSettingsService); $this->testFinder = new Tx_Phpunit_Service_TestFinder(); $this->extensionSettingsService = new Tx_Phpunit_TestingDataContainer(); $this->testFinder->injectExtensionSettingsService($this->extensionSettingsService); $this->subject->injectTestFinder($this->testFinder); $this->testCaseService = new Tx_Phpunit_Service_TestCaseService(); $this->testCaseService->injectUserSettingsService($this->userSettingsService); $this->subject->injectTestCaseService($this->testCaseService); $this->progressBarViewHelper = $this->getMock('Tx_Phpunit_ViewHelpers_ProgressBarViewHelper'); GeneralUtility::addInstance('Tx_Phpunit_ViewHelpers_ProgressBarViewHelper', $this->progressBarViewHelper); $this->documentTemplate = $this->getMock('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate', array('startPage')); GeneralUtility::addInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate', $this->documentTemplate); $this->singletonInstances = GeneralUtility::getSingletonInstances(); }
/** * @test * * Note: This tests uses a lowercase compare because some systems use a * case-insensitive file system. */ public function findTestsPathForExtensionForExtensionWithLowerCaseTestsDirectoryReturnsThatDirectory() { if (!ExtensionManagementUtility::isLoaded('bbb')) { self::markTestSkipped('This test can only be run if the extension "bbb" from TestExtensions/ is installed.'); } self::assertSame(strtolower(ExtensionManagementUtility::extPath('bbb') . 'tests/'), strtolower($this->subject->findTestsPathForExtension('bbb'))); }
protected function setUp() { if (!empty($GLOBALS['LANG'])) { $this->languageServiceBackup = $GLOBALS['LANG']; } /** @var LanguageService|\PHPUnit_Framework_MockObject_MockObject $languageServiceMock */ $languageServiceMock = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService'); $languageServiceMock->expects($this->any())->method('getLL')->willReturn('translatedLabel'); $GLOBALS['LANG'] = $languageServiceMock; $this->subject = new \Tx_Phpunit_ViewHelpers_ExtensionSelectorViewHelper(); $this->outputService = new \Tx_Phpunit_Service_FakeOutputService(); $this->subject->injectOutputService($this->outputService); $this->extensionSettingsService = new \Tx_Phpunit_TestingDataContainer(); $this->testFinder = new \Tx_Phpunit_Service_TestFinder(); $this->testFinder->injectExtensionSettingsService($this->extensionSettingsService); $this->subject->injectTestFinder($this->testFinder); $this->userSettingsService = new \Tx_Phpunit_TestingDataContainer(); $this->subject->injectUserSettingService($this->userSettingsService); }
/** * Creates the CSS style attribute content for an icon for the extension * $extensionKey. * * @param string $extensionKey * the key of a loaded extension, may also be "typo3" * * @return string the content for the "style" attribute, will not be empty * * @throws Tx_Phpunit_Exception_NoTestsDirectory * if there is not extension with tests with the given key */ protected function createIconStyle($extensionKey) { if ($extensionKey === '') { throw new Tx_Phpunit_Exception_NoTestsDirectory('$extensionKey must not be empty.', 1303503647); } if (!$this->testFinder->existsTestableForKey($extensionKey)) { throw new Tx_Phpunit_Exception_NoTestsDirectory('The extension ' . $extensionKey . ' is not loaded.', 1303503664); } $testable = $this->testFinder->getTestableForKey($extensionKey); return 'background: url(' . $testable->getIconPath() . ') 3px 50% white no-repeat; padding: 1px 1px 1px 24px;'; }
/** * Creates the CSS style attribute content for an icon for the testable with the key $testableKey. * * @param string $testableKey * the key of a Tx_Phpunit_Testable object, may also be "typo3", must not be empty * * @return string the content for the "style" attribute, will not be empty * * @throws InvalidArgumentException * if there is no extension with tests for the given key */ protected function createIconStyle($testableKey) { $testable = $this->testFinder->getTestableForKey($testableKey); return 'background: url(' . $testable->getIconPath() . ') 3px 50% white no-repeat; padding: 1px 1px 1px 24px;'; }
/** * @test */ public function createIconStyleForCoreReturnsTypo3Icon() { $testFinder = new Tx_Phpunit_Service_TestFinder(); if (!$testFinder->hasCoreTests()) { $this->markTestSkipped('This test can only be run if the TYPO3 Core unit tests are present.'); } $this->assertContains('url(' . t3lib_extMgm::extRelPath('phpunit') . 'Resources/Public/Icons/Typo3.png)', $this->fixture->createIconStyle(Tx_Phpunit_Testable::CORE_KEY)); }