/** * @test * @return void */ public function previousNeighbourCanBeFound() { $this->news->_setProperty('uid', 106); $fo = $this->mockedViewHelper->_call('getNeighbours', $this->news, '', 'datetime'); $exp = [0 => ['uid' => 105, 'title' => NULL], 1 => ['uid' => 106, 'title' => NULL]]; $this->assertEquals($exp, $fo); }
/** * @test */ public function createEntryFromRawDataSetsLinkIfPathIsGivenInEntryObject() { $rawModule = array('path' => 'pathTest'); /** @var $entry \TYPO3\CMS\Backend\Domain\Model\Module\BackendModule */ $entry = $this->moduleController->_call('createEntryFromRawData', $rawModule); $this->assertEquals('pathTest', $entry->getLink()); }
/** * @test * @deprecated since 6.2. Test can be removed if injectInstallTool method is dropped */ public function createValidationErrorMessageAddsErrorMessage() { $installTool = $this->getMock('stdClass', array('addErrorMessage'), array(), '', FALSE); $installTool->expects($this->once())->method('addErrorMessage')->with('Validating the security token of this form has failed. ' . 'Please reload the form and submit it again.'); $this->fixture->injectInstallTool($installTool); $this->fixture->_call('createValidationErrorMessage'); }
/** * @test */ public function reviewStatesArePopulatedAsSecureKeyInExtraSection() { $packages = $this->generator->_call('getPackages', $this->fixture); $this->assertTrue(isset($packages['archive']['typo3-ter/gridelements']['2.0.0']['extra']['typo3/ter']['reviewstate'])); $this->assertSame('insecure', $packages['archive']['typo3-ter/gridelements']['2.0.0']['extra']['typo3/ter']['reviewstate']); $this->assertFalse(isset($packages['archive']['typo3-ter/gridelements']['2.0.0']['extra']['typo3/ter']['extra']['reviewstate'])); }
/** * @test */ public function importTemporaryFileFixesPermissionsForTemporaryFile() { $mockTempFile = vfsStream::newFile('SomeTemporaryFile', 0333)->withContent('fixture')->at($this->mockDirectory); $this->writableFileSystemStorage->_call('importTemporaryFile', $mockTempFile->url(), 'default'); // dummy assertion to suppress PHPUnit warning $this->assertTrue(TRUE); }
/** * @test */ public function subProcessCommandEvaluatesSubRequestIniEntriesCorrectly() { $settings = array('core' => array('context' => 'Testing', 'phpBinaryPathAndFilename' => '/must/be/set/according/to/schema', 'subRequestIniEntries' => array('someSetting' => 'withValue', 'someFlagSettingWithoutValue' => ''))); $actual = $this->scriptsMock->_call('buildSubprocessCommand', 'flow:foo:identifier', $settings); $this->assertContains(sprintf(' -d %s=%s ', escapeshellarg('someSetting'), escapeshellarg('withValue')), $actual); $this->assertContains(sprintf(' -d %s ', escapeshellarg('someFlagSettingWithoutValue')), $actual); }
/** * @param bool|string $expected * @param array $page * @param array $rootLine * @test * @dataProvider selectedCombinedIdentifierIsDeterminedDataProvider */ public function selectedCombinedIdentifierIsDetermined($expected, array $page, array $rootLine) { $pageId = $page['uid']; $this->backendLayoutView->expects($this->once())->method('getPage')->with($this->equalTo($pageId))->will($this->returnValue($page)); $this->backendLayoutView->expects($this->any())->method('getRootLine')->with($this->equalTo($pageId))->will($this->returnValue($rootLine)); $selectedCombinedIdentifier = $this->backendLayoutView->_call('getSelectedCombinedIdentifier', $pageId); $this->assertEquals($expected, $selectedCombinedIdentifier); }
/** * @test */ public function importTemporaryFileSkipsFilesThatAlreadyExist() { $mockTempFile = vfsStream::newFile('SomeTemporaryFile', 0333)->withContent('fixture')->at($this->mockDirectory); $finalTargetPathAndFilename = $this->writableFileSystemStorage->_call('getStoragePathAndFilenameByHash', sha1('fixture')); Files::createDirectoryRecursively(dirname($finalTargetPathAndFilename)); file_put_contents($finalTargetPathAndFilename, 'existing file'); $this->writableFileSystemStorage->_call('importTemporaryFile', $mockTempFile->url(), 'default'); $this->assertSame('existing file', file_get_contents($finalTargetPathAndFilename)); }
/** * @test */ public function tokenFromSessionDataIsAvailableForValidateToken() { $sessionToken = '881ffea2159ac72182557b79dc0c723f5a8d20136f9fab56cdd4f8b3a1dbcfcd'; $formName = 'foo'; $action = 'edit'; $formInstanceName = '42'; $tokenId = \TYPO3\CMS\Core\Utility\GeneralUtility::hmac($formName . $action . $formInstanceName . $sessionToken); $_SESSION['installToolFormToken'] = $sessionToken; $this->subject->_call('retrieveSessionToken'); $this->assertTrue($this->subject->validateToken($tokenId, $formName, $action, $formInstanceName)); }
/** * @param array $requestArguments * @param array $expectedConfiguration * @param string $pid * @test * @dataProvider configurationDataProvider */ public function configurationIsGeneratedCorrectlyFromRequest(array $requestArguments, array $expectedConfiguration, $pid = '42') { $tsfeMock = $this->getMock('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(), array(), '', FALSE); $tsfeMock->id = 42; $tsfeMock->page = array('pid' => $pid); $contextFixture = new RenderingContext($tsfeMock); $requestFixture = new Request($requestArguments); // This tests if the provided data makes sense $this->assertTrue($this->renderer->canRender($requestFixture)); // Actual test $this->assertSame($expectedConfiguration, $this->renderer->_call('resolveRenderingConfiguration', new Request($requestArguments), $contextFixture)); }
/** * @param array $requestArguments * @param array $expectedConfiguration * @param string $pageId * @test * @dataProvider configurationDataProvider */ public function configurationIsGeneratedCorrectlyFromRequest(array $requestArguments, array $expectedConfiguration, $pageId = '42') { $tsfeMock = $this->getMock('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(), array(), '', FALSE); $pageRepositoryMock = $this->getMock('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $pageRepositoryMock->expects($this->any())->method('getRootLine')->willReturn(array(array('uid' => '1', 'pid' => '0'))); $tsfeMock->id = $pageId; $tsfeMock->sys_page = $pageRepositoryMock; $contextFixture = new RenderingContext($tsfeMock); $requestFixture = new Request($requestArguments); // This tests if the provided data makes sense $this->assertTrue($this->renderer->canRender($requestFixture)); // Actual test $this->assertSame($expectedConfiguration, $this->renderer->_call('resolveRenderingConfiguration', new Request($requestArguments), $contextFixture)); }
/** * @param string $value * @param string $expectedValue * * @dataProvider checkValue_checkReturnsExpectedValuesDataProvider * @test */ public function checkValue_checkReturnsExpectedValues($value, $expectedValue) { $expectedResult = array('value' => $expectedValue); $result = array(); $tcaFieldConfiguration = array('items' => array(array('Item 1', 0), array('Item 2', 0), array('Item 3', 0))); $this->assertSame($expectedResult, $this->subject->_call('checkValueForCheck', $result, $value, $tcaFieldConfiguration, '', 0, 0, '')); }
/** * @test */ public function getContextSpecificFrameworkConfigurationSetsDefaultRequestHandlersIfRequestHandlersAreNotConfigured() { $frameworkConfiguration = array('pluginName' => 'Pi1', 'extensionName' => 'SomeExtension', 'foo' => array('bar' => array('baz' => 'Foo'))); $expectedResult = array('pluginName' => 'Pi1', 'extensionName' => 'SomeExtension', 'foo' => array('bar' => array('baz' => 'Foo')), 'mvc' => array('requestHandlers' => array(\TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler::class => \TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler::class, \TYPO3\CMS\Extbase\Mvc\Web\BackendRequestHandler::class => \TYPO3\CMS\Extbase\Mvc\Web\BackendRequestHandler::class))); $actualResult = $this->backendConfigurationManager->_call('getContextSpecificFrameworkConfiguration', $frameworkConfiguration); $this->assertEquals($expectedResult, $actualResult); }
/** * @test */ public function getAllMessagesAndFlushClearsSessionStack() { $flashMessage = new \TYPO3\CMS\Core\Messaging\FlashMessage('Transient', 'Title', \TYPO3\CMS\Core\Messaging\FlashMessage::OK, TRUE); $this->flashMessageQueue->enqueue($flashMessage); $this->flashMessageQueue->getAllMessagesAndFlush(); /** @var $frontendUser \TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication */ $frontendUser = $this->flashMessageQueue->_call('getUserByContext'); $this->assertNull($frontendUser->getSessionData('core.template.flashMessages')); }
/** * @test */ public function forceAbsoluteUrlReturnsCorrectAbsoluteUrlWithSubfolder() { // Force hostname and subfolder $this->subject->expects($this->any())->method('getEnvironmentVariable')->will($this->returnValueMap(array(array('HTTP_HOST', 'localhost'), array('TYPO3_SITE_PATH', '/subfolder/')))); $expected = 'http://localhost/subfolder/fileadmin/my.pdf'; $url = 'fileadmin/my.pdf'; $configuration = array('forceAbsoluteUrl' => '1'); $this->assertEquals($expected, $this->subject->_call('forceAbsoluteUrl', $url, $configuration)); }
/** * @dataProvider groupAccessCheckDataProvider * @param $checkArray * @test */ public function groupAccessChecksWorksAsExpected($checkArray) { $this->fixture->_set('extensionConfiguration', array('enableGroupCheck' => '1', 'groupCheckDirs' => $checkArray['groupCheckDirs'], 'excludeGroups' => $checkArray['excludedGroups'])); $fakeUser = new \stdClass(); $fakeUser->groupData['uid'] = $checkArray['actualGroups']; $this->fixture->_set('feUserObj', $fakeUser); $this->fixture->_set('file', $checkArray['file']); $this->fixture->_set('userGroups', $checkArray['transmittedGroups']); $this->assertSame($checkArray['expected'], $this->fixture->_call('checkGroupAccess')); }
/** * @test */ public function convertDomainObjectsToIdentityArraysConvertsDomainObjects() { $mockDomainObject1 = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity', array('dummy')); $mockDomainObject1->_set('uid', '123'); $mockDomainObject2 = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity', array('dummy')); $mockDomainObject2->_set('uid', '321'); $expectedResult = array('foo' => array('bar' => 'baz'), 'domainObject1' => '123', 'second' => array('domainObject2' => '321')); $actualResult = $this->uriBuilder->_call('convertDomainObjectsToIdentityArrays', array('foo' => array('bar' => 'baz'), 'domainObject1' => $mockDomainObject1, 'second' => array('domainObject2' => $mockDomainObject2))); $this->assertEquals($expectedResult, $actualResult); }
/** * @test */ public function overrideConfigurationFromFlexFormChecksForDataIsArrayAndEmpty() { /** @var $flexFormService \TYPO3\CMS\Extbase\Service\FlexFormService|\PHPUnit_Framework_MockObject_MockObject */ $flexFormService = $this->getMock('TYPO3\\CMS\\Extbase\\Service\\FlexFormService', array('convertFlexFormContentToArray')); $flexFormService->expects($this->never())->method('convertFlexFormContentToArray'); $this->frontendConfigurationManager->_set('flexFormService', $flexFormService); $this->mockContentObject->data = array('pi_flexform' => array()); $frameworkConfiguration = array('persistence' => array('storagePid' => '98')); $this->assertSame(array('persistence' => array('storagePid' => '98')), $this->frontendConfigurationManager->_call('overrideConfigurationFromFlexForm', $frameworkConfiguration)); }
/** * @param string $currentDomain * @test * @dataProvider getSysDomainCacheDataProvider */ public function getSysDomainCacheReturnsForcedDomainRecord($currentDomain) { $_SERVER['HTTP_HOST'] = $currentDomain; $domainRecords = array('typo3.org' => array('uid' => '1', 'pid' => '1', 'domainName' => 'typo3.org', 'forced' => 0), 'foo.bar' => array('uid' => '2', 'pid' => '1', 'domainName' => 'foo.bar', 'forced' => 1), 'example.com' => array('uid' => '3', 'pid' => '1', 'domainName' => 'example.com', 'forced' => 0)); $GLOBALS['TYPO3_DB'] = $this->getMock(DatabaseConnection::class, array('exec_SELECTgetRows')); $GLOBALS['TYPO3_DB']->expects($this->any())->method('exec_SELECTgetRows')->willReturn($domainRecords); GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_runtime')->flush(); $expectedResult = array($domainRecords[$currentDomain]['pid'] => $domainRecords['foo.bar']); $this->assertEquals($expectedResult, $this->subject->_call('getSysDomainCache')); }
/** * Tests optimizing a CSS asset group. * * @test * @dataProvider compressCssFileContentDataProvider * @param string $cssFile * @param string $expected */ public function compressCssFileContent($cssFile, $expected) { $cssContent = file_get_contents($cssFile); $compressedCss = $this->subject->_call('compressCssString', $cssContent); // we have to fix relative paths, if we aren't working on a file in our target directory $relativeFilename = str_replace(PATH_site, '', $cssFile); if (strpos($relativeFilename, $this->subject->_get('targetDirectory')) === false) { $compressedCss = $this->subject->_call('cssFixRelativeUrlPaths', $compressedCss, dirname($relativeFilename) . '/'); } $this->assertEquals(file_get_contents($expected), $compressedCss, 'Group of file CSS assets optimized correctly.'); }
/** * @test * @return void */ public function mergeWithExistingConfigurationOverwritesDefaultKeysWithCurrent() { $localConfiguration = serialize(array('FE.' => array('enabled' => '1', 'saltedPWHashingMethod' => \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface_sha1::class), 'CLI.' => array('enabled' => '0'))); $configurationManagerMock = $this->getMock(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class); $configurationManagerMock->expects($this->once())->method('getConfigurationValueByPath')->with('EXT/extConf/testextensionkey')->will($this->returnValue($localConfiguration)); $this->injectedObjectManagerMock->expects($this->any())->method('get')->will($this->returnValue($configurationManagerMock)); $defaultConfiguration = array('FE.enabled' => array('value' => '0'), 'FE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\Md5Salt::class), 'BE.enabled' => array('value' => '1'), 'BE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\Md5Salt::class)); $expectedResult = array('FE.enabled' => array('value' => '1'), 'FE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface_sha1::class), 'BE.enabled' => array('value' => '1'), 'BE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\Md5Salt::class), 'CLI.enabled' => array('value' => '0')); $actualResult = $this->configurationItemRepository->_call('mergeWithExistingConfiguration', $defaultConfiguration, 'testextensionkey'); $this->assertEquals($expectedResult, $actualResult); }
/** * @test * @see http://forge.typo3.org/issues/21902 */ public function locateStatementWithExternalTableIsProperlyRemapped() { $selectFields = '*, CASE WHEN' . ' LOCATE(' . $this->subject->fullQuoteStr('(fce)', 'tx_templavoila_tmplobj') . ', tx_templavoila_tmplobj.datastructure, 4)>0 THEN 2' . ' ELSE 1' . ' END AS scope'; $fromTables = 'tx_templavoila_tmplobj'; $whereClause = '1=1'; $groupBy = ''; $orderBy = ''; $remappedParameters = $this->subject->_call('map_remapSELECTQueryParts', $selectFields, $fromTables, $whereClause, $groupBy, $orderBy); $result = $this->subject->_call('SELECTqueryFromArray', $remappedParameters); $expected = 'SELECT *, CASE WHEN CHARINDEX(\'(fce)\', "tx_templavoila_tmplobj"."ds", 4) > 0 THEN 2 ELSE 1 END AS "scope" FROM "tx_templavoila_tmplobj" WHERE 1 = 1'; $this->assertEquals($expected, $this->cleanSql($result)); }
/** * @test */ public function elseArgumentHasPriorityOverChildNodesIfConditionIsFalse() { $mockElseViewHelperNode = $this->createMock(\TYPO3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode::class, array('getViewHelperClassName', 'evaluate', 'setRenderingContext'), array(), '', false); $mockElseViewHelperNode->expects($this->any())->method('getViewHelperClassName')->will($this->returnValue(\TYPO3\Fluid\ViewHelpers\ElseViewHelper::class)); $mockElseViewHelperNode->expects($this->never())->method('evaluate'); $this->viewHelper->setChildNodes(array($mockElseViewHelperNode)); $this->viewHelper->expects($this->atLeastOnce())->method('hasArgument')->with('else')->will($this->returnValue(true)); $this->arguments['else'] = 'ElseArgument'; $this->injectDependenciesIntoViewHelper($this->viewHelper); $actualResult = $this->viewHelper->_call('renderElseChild'); $this->assertEquals('ElseArgument', $actualResult); }
/** * @test */ public function getLayoutPathAndFilenameWalksStringKeysInReversedOrder() { $this->view->setLayoutRootPaths(array('default' => 'some/Default/Directory', 'specific' => 'specific/Layout', 'verySpecific' => 'evenMore/Specific/Layout')); $this->mockRequest->expects($this->any())->method('getFormat')->will($this->returnValue('html')); $this->view->expects($this->at(0))->method('testFileExistence')->with(PATH_site . 'evenMore/Specific/Layout/Default.html')->will($this->returnValue(false)); $this->view->expects($this->at(1))->method('testFileExistence')->with(PATH_site . 'evenMore/Specific/Layout/Default')->will($this->returnValue(false)); $this->view->expects($this->at(2))->method('testFileExistence')->with(PATH_site . 'specific/Layout/Default.html')->will($this->returnValue(false)); $this->view->expects($this->at(3))->method('testFileExistence')->with(PATH_site . 'specific/Layout/Default')->will($this->returnValue(false)); $this->view->expects($this->at(4))->method('testFileExistence')->with(PATH_site . 'some/Default/Directory/Default.html')->will($this->returnValue(false)); $this->view->expects($this->at(5))->method('testFileExistence')->with(PATH_site . 'some/Default/Directory/Default')->will($this->returnValue(true)); $this->assertEquals(PATH_site . 'some/Default/Directory/Default', $this->view->_call('getLayoutPathAndFilename')); }
/** * @test * @see http://forge.typo3.org/issues/23087 */ public function findInSetFieldIsProperlyRemapped() { $selectFields = 'fe_group'; $fromTables = 'tt_news'; $whereClause = 'FIND_IN_SET(10, fe_group)'; $groupBy = ''; $orderBy = ''; $remappedParameters = $this->subject->_call('map_remapSELECTQueryParts', $selectFields, $fromTables, $whereClause, $groupBy, $orderBy); $result = $this->subject->_call('SELECTqueryFromArray', $remappedParameters); $expected = 'SELECT "usergroup" FROM "ext_tt_news" WHERE \',\'||"ext_tt_news"."usergroup"||\',\' LIKE \'%,10,%\''; $this->assertEquals($expected, $this->cleanSql($result)); }
/** * @test */ public function getRecordArrayFetchesTranslationWhenLanguageIdIsSet() { $pageData = array('uid' => 1, 'title' => 'Original'); $pageDataTranslated = array('uid' => 1, 'title' => 'Translated', '_PAGES_OVERLAY_UID' => '2'); $this->subject->expects($this->any())->method('enrichWithRelationFields')->with(2, $pageDataTranslated)->will($this->returnArgument(1)); $databaseConnectionMock = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class); $databaseConnectionMock->expects($this->once())->method('exec_SELECTgetSingleRow')->will($this->returnValue($pageData)); $this->subject->_set('databaseConnection', $databaseConnectionMock); $this->pageContextMock->expects($this->any())->method('getPageOverlay')->will($this->returnValue($pageDataTranslated)); $this->subject->_set('languageUid', 1); $this->assertSame($pageDataTranslated, $this->subject->_call('getRecordArray', 1)); }
/** * @test */ public function elseArgumentHasPriorityOverChildNodesIfConditionIsFalse() { $mockElseViewHelperNode = $this->getMock(ViewHelperNode::class, ['getViewHelperClassName', 'evaluate', 'setRenderingContext'], [], '', false); $mockElseViewHelperNode->expects($this->any())->method('getViewHelperClassName')->will($this->returnValue(ElseViewHelper::class)); $mockElseViewHelperNode->expects($this->never())->method('evaluate'); $this->viewHelper->setChildNodes([$mockElseViewHelperNode]); $this->viewHelper->expects($this->atLeastOnce())->method('hasArgument')->with('else')->will($this->returnValue(true)); $this->arguments['else'] = 'ElseArgument'; $this->injectDependenciesIntoViewHelper($this->viewHelper); $actualResult = $this->viewHelper->_call('renderElseChild'); $this->assertEquals('ElseArgument', $actualResult); }
/** * @test * @param string $linkParameter * @param string $expectedResult * @dataProvider detectLinkTypeFromLinkParameterDataProvider */ public function detectLinkTypeFromLinkParameter($linkParameter, $expectedResult) { /** @var TemplateService|\PHPUnit_Framework_MockObject_MockObject $templateServiceObjectMock */ $templateServiceObjectMock = $this->getMock(TemplateService::class, array('dummy')); $templateServiceObjectMock->setup = array('lib.' => array('parseFunc.' => $this->getLibParseFunc())); /** @var TypoScriptFrontendController|\PHPUnit_Framework_MockObject_MockObject $typoScriptFrontendControllerMockObject */ $typoScriptFrontendControllerMockObject = $this->getMock(TypoScriptFrontendController::class, array(), array(), '', false); $typoScriptFrontendControllerMockObject->config = array('config' => array(), 'mainScript' => 'index.php'); $typoScriptFrontendControllerMockObject->tmpl = $templateServiceObjectMock; $GLOBALS['TSFE'] = $typoScriptFrontendControllerMockObject; $this->subject->_set('typoScriptFrontendController', $typoScriptFrontendControllerMockObject); $this->assertEquals($expectedResult, $this->subject->_call('detectLinkTypeFromLinkParameter', $linkParameter)); }
/** * @test */ public function createValidationErrorMessageAddsErrorFlashMessageButNotInSessionInAjaxRequest() { /** @var $flashMessageServiceMock \TYPO3\CMS\Core\Messaging\FlashMessageService|\PHPUnit_Framework_MockObject_MockObject */ $flashMessageServiceMock = $this->getMock('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService', $flashMessageServiceMock); $flashMessageQueueMock = $this->getMock('TYPO3\\CMS\\Core\\Messaging\\FlashMessageQueue', array(), array(), '', FALSE); $flashMessageServiceMock->expects($this->once())->method('getMessageQueueByIdentifier')->will($this->returnValue($flashMessageQueueMock)); $flashMessageQueueMock->expects($this->once())->method('enqueue')->with($this->isInstanceOf('TYPO3\\CMS\\Core\\Messaging\\FlashMessage'))->will($this->returnCallback(array($this, 'enqueueAjaxFlashMessageCallback'))); $languageServiceMock = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array(), array(), '', FALSE); $languageServiceMock->expects($this->once())->method('sL')->will($this->returnValue('foo')); $this->subject->expects($this->once())->method('getLanguageService')->will($this->returnValue($languageServiceMock)); $this->subject->expects($this->any())->method('isAjaxRequest')->will($this->returnValue(TRUE)); $this->subject->_call('createValidationErrorMessage'); }
/** * @test */ public function prepareObjectsSliceReturnsCorrectPortionForArrayAndSecondPage() { $this->controller->_set('currentPage', 2); $objects = array(); for ($i = 0; $i <= 55; $i++) { $item = new \stdClass(); $objects[] = $item; } $this->controller->_set('objects', $objects); $expectedPortion = array(); for ($j = 10; $j <= 19; $j++) { $expectedPortion = array_slice($objects, 10, 10); } $this->assertSame($expectedPortion, $this->controller->_call('prepareObjectsSlice', 10, 10)); }