‪TYPO3CMS  9.5
PageRepositoryTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
19 
23 class ‪PageRepositoryTest extends UnitTestCase
24 {
28  protected ‪$pageSelectObject;
29 
30  protected ‪$defaultTcaForPages = [
31  'ctrl' => [
32  'label' => 'title',
33  'tstamp' => 'tstamp',
34  'sortby' => 'sorting',
35  'type' => 'doktype',
36  'versioningWS' => true,
37  'origUid' => 't3_origuid',
38  'delete' => 'deleted',
39  'enablecolumns' => [
40  'disabled' => 'hidden',
41  'starttime' => 'starttime',
42  'endtime' => 'endtime',
43  'fe_group' => 'fe_group'
44  ],
45  ],
46  'columns' => []
47  ];
48 
52  protected function ‪setUp()
53  {
54  $this->pageSelectObject = $this->getAccessibleMock(\‪TYPO3\CMS\Frontend\Page\PageRepository::class, ['getMultipleGroupsWhereClause'], [], '', false);
55  $this->pageSelectObject->_set('context', new ‪Context());
56  $this->pageSelectObject->expects($this->any())->method('getMultipleGroupsWhereClause')->will($this->returnValue(' AND 1=1'));
57  }
58 
60  // Tests concerning getExtURL
62 
66  {
67  $this->assertEquals('http://www.example.com', $this->pageSelectObject->getExtURL([
68  'doktype' => \‪TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_LINK,
69  'url' => 'http://www.example.com'
70  ]));
71  }
72 
77  {
78  $this->assertEquals(\‪TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'hello/world/', $this->pageSelectObject->getExtURL([
79  'doktype' => \‪TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_LINK,
80  'url' => 'hello/world/'
81  ]));
82  }
83 
88  {
89  $this->assertEquals('/hello/world/', $this->pageSelectObject->getExtURL([
90  'doktype' => \‪TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_LINK,
91  'url' => '/hello/world/'
92  ]));
93  }
94 
99  {
100  $this->assertEquals('mailto:mail@typo3-test.com', $this->pageSelectObject->getExtURL([
101  'doktype' => \‪TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_LINK,
102  'url' => 'mailto:mail@typo3-test.com'
103  ]));
104  }
105 
110  {
111  $this->assertEquals('mailto:mail@typo3-test.com', $this->pageSelectObject->getExtURL([
112  'doktype' => \‪TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_LINK,
113  'url' => 'mail@typo3-test.com'
114  ]));
115  }
116 }
‪TYPO3
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageRepositoryTest\$defaultTcaForPages
‪$defaultTcaForPages
Definition: PageRepositoryTest.php:29
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:49
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageRepositoryTest\getExtUrlForDokType3UsesValidEmailWithoutProtocolAsEmail
‪getExtUrlForDokType3UsesValidEmailWithoutProtocolAsEmail()
Definition: PageRepositoryTest.php:108
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageRepositoryTest\getExtUrlForDokType3PrependsSiteUrl
‪getExtUrlForDokType3PrependsSiteUrl()
Definition: PageRepositoryTest.php:75
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageRepositoryTest\$pageSelectObject
‪TYPO3 CMS Frontend Page PageRepository TYPO3 TestingFramework Core AccessibleObjectInterface $pageSelectObject
Definition: PageRepositoryTest.php:27
‪TYPO3\CMS\Frontend\Tests\Unit\Page
Definition: CacheHashCalculatorTest.php:3
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageRepositoryTest
Definition: PageRepositoryTest.php:24
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageRepositoryTest\setUp
‪setUp()
Definition: PageRepositoryTest.php:51
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageRepositoryTest\getExtUrlForDokType3UsesEmailAsSameValue
‪getExtUrlForDokType3UsesEmailAsSameValue()
Definition: PageRepositoryTest.php:97
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageRepositoryTest\getExtUrlForDokType3UsesTheSameValue
‪getExtUrlForDokType3UsesTheSameValue()
Definition: PageRepositoryTest.php:64
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageRepositoryTest\getExtUrlForDokType3AssumesAbsoluteUrl
‪getExtUrlForDokType3AssumesAbsoluteUrl()
Definition: PageRepositoryTest.php:86