2 declare(strict_types = 1);
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
47 protected function setUp()
53 $GLOBALS[
'TSFE']->cObjectDepthCounter = 100;
57 $contentObjectRenderer->setContentObjectClassMap([
58 'TEXT' => TextContentObject::class,
60 $this->abstractPlugin->cObj = $contentObjectRenderer;
61 $this->defaultPiVars = $this->abstractPlugin->piVars;
72 'stdWrap on conf, non-recursive, stdWrap 1 level deep' => [
77 'wrap' =>
'test | test'
82 'abc' =>
'testDEFtest',
89 'stdWrap on conf, non-recursive, stdWrap 2 levels deep' => [
109 'stdWrap on conf, recursive' => [
116 'wrap' =>
'test | test'
123 'def' =>
'testDEFtest',
143 $this->resetSingletonInstances =
true;
146 $this->abstractPlugin->conf[
'_DEFAULT_PI_VARS.'] = $input;
147 $this->abstractPlugin->pi_setPiVarDefaults();
148 $this->assertEquals($expected, $this->abstractPlugin->piVars);
159 'Result browser returning false' => [
160 'className' => $this->getUniqueId(
'tx_coretest'),
161 'returnValue' =>
false,
164 'Result browser returning null' => [
165 'className' => $this->getUniqueId(
'tx_coretest'),
166 'returnValue' =>
null,
169 'Result browser returning whitespace string' => [
170 'className' => $this->getUniqueId(
'tx_coretest'),
171 'returnValue' =>
' ',
174 'Result browser returning HTML' => [
175 'className' => $this->getUniqueId(
'tx_coretest'),
176 'returnValue' =>
'<div><a href="index.php?id=1&pointer=1">1</a><a href="index.php?id=1&pointer=2">2</a><a href="index.php?id=1&pointer=3">3</a><a href="index.php?id=1&pointer=4">4</a></div>',
177 'expected' =>
'<div><a href="index.php?id=1&pointer=1">1</a><a href="index.php?id=1&pointer=2">2</a><a href="index.php?id=1&pointer=3">3</a><a href="index.php?id=1&pointer=4">4</a></div>'
179 'Result browser returning a truthy integer as string' => [
180 'className' => $this->getUniqueId(
'tx_coretest'),
181 'returnValue' =>
'1',
184 'Result browser returning a falsy integer' => [
185 'className' => $this->getUniqueId(
'tx_coretest'),
189 'Result browser returning a truthy integer' => [
190 'className' => $this->getUniqueId(
'tx_coretest'),
194 'Result browser returning a positive integer' => [
195 'className' => $this->getUniqueId(
'tx_coretest'),
212 $resultBrowserHook = $this->getMockBuilder(ResultBrowserPluginHook::class)
213 ->setMockClassName($className)
214 ->setMethods([
'pi_list_browseresults'])
215 ->disableOriginalConstructor()
219 GeneralUtility::addInstance($className, $resultBrowserHook);
220 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][AbstractPlugin::class][
'pi_list_browseresults'] = [$className];
222 $resultBrowserHook->expects($this->atLeastOnce())
223 ->method(
'pi_list_browseresults')
224 ->with(1,
'', [],
'pointer',
true,
false, $this->abstractPlugin)
225 ->will($this->returnValue($returnValue));
227 $actualReturnValue = $this->abstractPlugin->pi_list_browseresults();
229 $this->assertSame($expected, $actualReturnValue);
231 unset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][AbstractPlugin::class][
'pi_list_browseresults']);