php TYPO3-CMS-Core-Tests-AccessibleObjectInterface类(方法)实例源码

下面列出了php TYPO3-CMS-Core-Tests-AccessibleObjectInterface 类(方法)源码代码实例,从而了解它的用法。

作者:rickymathe    项目:TYPO3.CM   
/**
  * @test
  */
 public function initializeObjectSetsRespectStoragePidToFalse()
 {
     $this->querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(false);
     $fixture = $this->getMock(\TYPO3\CMS\Belog\Domain\Repository\HistoryEntryRepository::class, array('setDefaultQuerySettings'), array($this->objectManager));
     $fixture->expects($this->once())->method('setDefaultQuerySettings')->with($this->querySettings);
     $fixture->initializeObject();
 }

作者:rickymathe    项目:TYPO3.CM   
/**
  * @test
  */
 public function persistSessionTokenWritesTokensToSession()
 {
     $_SESSION['installToolFormToken'] = 'foo';
     $this->subject->_set('sessionToken', '881ffea2159ac72182557b79dc0c723f5a8d20136f9fab56cdd4f8b3a1dbcfcd');
     $this->subject->persistSessionToken();
     $this->assertEquals('881ffea2159ac72182557b79dc0c723f5a8d20136f9fab56cdd4f8b3a1dbcfcd', $_SESSION['installToolFormToken']);
 }

作者:mrmore    项目:vkmh_typo   
/**
  * @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);
 }

作者:rickymathe    项目:TYPO3.CM   
/**
  * @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());
 }

作者:khanhdeu    项目:typo3tes   
/**
  * @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');
 }

作者:VladStawizk    项目:ipl-logistik.d   
/**
  * Test for render()
  *
  * @param string $validation
  * @param string $expectedResult
  * @param bool $nativeValidationEnabled
  * @return void
  * @dataProvider renderReturnsStringDataProvider
  * @test
  */
 public function renderReturnsString($validation, $expectedResult, $nativeValidationEnabled)
 {
     $this->abstractValidationViewHelperMock->_set('settings', ['validation' => ['native' => $nativeValidationEnabled ? '1' : '0']]);
     $field = new Field();
     $field->setValidation($validation);
     $result = $this->abstractValidationViewHelperMock->_callRef('render', $field);
     $this->assertSame($expectedResult, $result);
 }

作者:rickymathe    项目:TYPO3.CM   
/**
  * @test
  * @expectedException \InvalidArgumentException
  * @expectedExceptionCode 1425236663
  */
 public function moduleDispatcherIsCalled()
 {
     $GLOBALS['TBE_MODULES'] = array('_PATHS' => array('module_fixture' => __DIR__ . '/../Fixtures/ModuleFixture/'));
     $this->requestMock->expects($this->any())->method('getQueryParams')->will($this->returnValue(array('M' => 'module_fixture')));
     $this->formProtectionMock->expects($this->once())->method('validateToken')->will($this->returnValue(true));
     $this->subject->expects($this->once())->method('boot');
     $this->subject->expects($this->atLeastOnce())->method('getFormProtection')->will($this->returnValue($this->formProtectionMock));
     $this->subject->handleRequest($this->requestMock);
 }

作者:adroll    项目:TYPO3.CM   
/**
  * @test
  * @expectedException \InvalidArgumentException
  * @expectedExceptionCode 1425236663
  */
 public function moduleDispatcherIsCalled()
 {
     $GLOBALS['TBE_MODULES'] = array('_PATHS' => array('_dispatcher' => array(), 'module_fixture' => __DIR__ . '/Fixtures/ModuleFixture/'));
     $_GET['M'] = 'module_fixture';
     $this->formProtectionMock->expects($this->once())->method('validateToken')->will($this->returnValue(TRUE));
     $this->subject->expects($this->once())->method('boot');
     $this->subject->expects($this->once())->method('getFormProtection')->will($this->returnValue($this->formProtectionMock));
     $this->subject->handleRequest();
 }

作者:VladStawizk    项目:ipl-logistik.d   
/**
  * Test for render()
  *
  * @param array $settings
  * @param array $additionalAttributes
  * @param array $expectedResult
  * @return void
  * @dataProvider renderReturnsArrayDataProvider
  * @test
  */
 public function renderReturnsArray($settings, $additionalAttributes, $expectedResult)
 {
     $form = new Form();
     $form->_setProperty('uid', 123);
     $this->enableParsleyAndAjaxViewHelperMock->_set('addRedirectUri', false);
     $this->enableParsleyAndAjaxViewHelperMock->_set('settings', $settings);
     $result = $this->enableParsleyAndAjaxViewHelperMock->_callRef('render', $form, $additionalAttributes);
     $this->assertSame($expectedResult, $result);
 }

作者:raimundlandi    项目:winkel.de-DE   
/**
  * @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));
 }

作者:paul-schuller    项目:typoscript_renderin   
/**
  * @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));
 }

作者:rickymathe    项目:TYPO3.CM   
/**
  * @test
  * @expectedException \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException
  */
 public function dispatchThrowsInvalidSlotExceptionIfObjectManagerOfSignalSlotDispatcherIsNotSet()
 {
     $this->signalSlotDispatcher->_set('isInitialized', true);
     $this->signalSlotDispatcher->_set('objectManager', null);
     $this->signalSlotDispatcher->_set('slots', array('ClassA' => array('emitSomeSignal' => array(array()))));
     $this->assertSame(null, $this->signalSlotDispatcher->dispatch('ClassA', 'emitSomeSignal'));
 }

作者:khanhdeu    项目:typo3tes   
/**
  * @test
  */
 public function multipleExpressiosInWhereClauseAreBracedCorrectly()
 {
     $listMaxExpressions = 1000;
     $mockSpecificsOci8 = $this->getAccessibleMock('TYPO3\\CMS\\Dbal\\Database\\Specifics\\Oci8', array(), array(), '', FALSE);
     $mockSpecificsOci8->expects($this->any())->method('getSpecific')->will($this->returnValue($listMaxExpressions));
     $INitems = range(0, 1250);
     $NOTINItems = range(0, 1001);
     $where = 'uid = 1981 AND uid IN(' . implode(',', $INitems) . ') OR uid = 42 AND uid NOT IN(' . implode(',', $NOTINItems) . ')';
     $result = $this->subject->SELECTquery('uid, pid', 'tt_content', $where);
     $chunks = array_chunk($INitems, $listMaxExpressions);
     $INItemsWhereExpr = array();
     foreach ($chunks as $chunk) {
         $INItemsWhereExpr[] = '"uid" IN (' . implode(',', $chunk) . ')';
     }
     $chunks = array_chunk($NOTINItems, $listMaxExpressions);
     $NOTINItemsWhereExpr = array();
     foreach ($chunks as $chunk) {
         $NOTINItemsWhereExpr[] = '"uid" NOT IN (' . implode(',', $chunk) . ')';
     }
     /**
      * $expectedWhere:
      * "uid" = 1981 AND (
      *        "uid" IN (1,2,3,4,...,1000)
      *     OR "uid" IN (1001,1002,...,1250)
      * ) OR "uid" = 42 AND (
      *        "uid" NOT IN (1,2,3,4,...,1000)
      *    AND "uid" NOT IN (1001)
      * )
      */
     $expectedWhere = '"uid" = 1981 AND (' . implode(' OR ', $INItemsWhereExpr) . ') OR "uid" = 42 AND (' . implode(' AND ', $NOTINItemsWhereExpr) . ')';
     $expectedQuery = 'SELECT "uid", "pid" FROM "tt_content" WHERE ' . $expectedWhere;
     $this->assertEquals($expectedQuery, $this->cleanSql($result));
 }

作者:VladStawizk    项目:ipl-logistik.d   
/**
  * Test for isClientValidationEnabled()
  *
  * @param array $settings
  * @param bool $expectedNativeResult
  * @param bool $expectedClientResult
  * @return void
  * @dataProvider isValidationEnabledReturnsBoolDataProvider
  * @test
  */
 public function isClientValidationEnabledReturnsBool($settings, $expectedNativeResult, $expectedClientResult)
 {
     unset($expectedNativeResult);
     $this->abstractValidationViewHelperMock->_set('settings', $settings);
     $result = $this->abstractValidationViewHelperMock->_callRef('isClientValidationEnabled');
     $this->assertSame($expectedClientResult, $result);
 }

作者:    项目:   
/**
  * Test for render()
  *
  * @param array $settings
  * @param array $fieldProperties
  * @param array $additionalAttributes
  * @param mixed $iteration
  * @param array $expectedResult
  * @return void
  * @dataProvider renderReturnsArrayDataProvider
  * @test
  */
 public function renderReturnsArray($settings, $fieldProperties, $additionalAttributes, $iteration, $expectedResult)
 {
     $field = new Field();
     foreach ($fieldProperties as $propertyName => $propertyValue) {
         $field->_setProperty($propertyName, $propertyValue);
     }
     $this->abstractValidationViewHelperMock->_set('settings', $settings);
     $this->abstractValidationViewHelperMock->_set('extensionName', 'powermail');
     $controllerContext = new ControllerContext();
     $request = new Request();
     $request->setControllerExtensionName('powermail');
     $controllerContext->setRequest($request);
     $this->abstractValidationViewHelperMock->_set('controllerContext', $controllerContext);
     $result = $this->abstractValidationViewHelperMock->_callRef('render', $field, $additionalAttributes, $iteration);
     $this->assertSame($expectedResult, $result);
 }

作者:samuweis    项目:TYPO3-Sit   
/**
  * @test
  * @expectedException \RuntimeException
  */
 public function updateRootlineDataWithInvalidNewRootlineThrowsException()
 {
     $originalRootline = array(0 => array('uid' => 2, 'title' => 'originalTitle'), 1 => array('uid' => 3, 'title' => 'originalTitle2'));
     $newInvalidRootline = array(0 => array('uid' => 1, 'title' => 'newTitle'), 1 => array('uid' => 2, 'title' => 'newTitle2'));
     $this->templateServiceMock->_set('rootLine', $originalRootline);
     $this->templateServiceMock->updateRootlineData($newInvalidRootline);
 }

作者:plan2ne    项目:TYPO3.CM   
/**
  * @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, ''));
 }

作者:plan2ne    项目:TYPO3.CM   
/**
  * @test
  */
 public function settingRequestAdminPropertySetsAdminRoleInUserAuthentication()
 {
     $mockedUserAuthentication = $this->getMock(\TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::class);
     $mockedUserAuthentication->user['admin'] = 42;
     $this->commandController->expects($this->once())->method('dummyCommand')->will($this->returnCallback(function () use($mockedUserAuthentication) {
         if ($mockedUserAuthentication->user['admin'] !== 1) {
             throw new \Exception('User role is not admin');
         }
     }));
     $this->commandController->_set('userAuthentication', $mockedUserAuthentication);
     $this->commandController->_set('arguments', array());
     $this->commandController->_set('commandMethodName', 'dummyCommand');
     $this->commandController->_set('requestAdminPermissions', TRUE);
     $this->commandController->_call('callCommandMethod');
     $this->assertSame(42, $mockedUserAuthentication->user['admin']);
 }

作者:rickymathe    项目:TYPO3.CM   
/**
  * @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);
 }

作者:rickymathe    项目:TYPO3.CM   
/**
  * @test
  */
 public function getAdditionalInformationRespectsArguments()
 {
     $this->task->_set('commandIdentifier', 'foo');
     $this->task->_set('defaults', array('bar' => 'baz'));
     $this->task->_set('arguments', array('qux' => 'quux'));
     $this->assertSame('foo qux=quux', $this->task->getAdditionalInformation());
 }


问题


面经


文章

微信
公众号

扫码关注公众号