diff --git a/Tests/Functional/BaseTest.php b/Tests/Functional/BaseHeadlessTesting.php
similarity index 97%
rename from Tests/Functional/BaseTest.php
rename to Tests/Functional/BaseHeadlessTesting.php
index b8b1f163..08e49125 100644
--- a/Tests/Functional/BaseTest.php
+++ b/Tests/Functional/BaseHeadlessTesting.php
@@ -18,7 +18,7 @@
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
-abstract class BaseTest extends FunctionalTestCase
+abstract class BaseHeadlessTesting extends FunctionalTestCase
{
protected array $coreExtensionsToLoad = [
'install',
@@ -34,7 +34,7 @@ public function setUp(): void
{
parent::setUp();
- $this->importDataSet(__DIR__ . '/Fixtures/pages.xml');
+ $this->importCSVDataSet(__DIR__ . '/Fixtures/pages.csv');
$this->setUpFrontendRootPage(
1,
diff --git a/Tests/Functional/ContentTypes/BaseContentTypeTest.php b/Tests/Functional/ContentTypes/BaseContentTypeTesting.php
similarity index 93%
rename from Tests/Functional/ContentTypes/BaseContentTypeTest.php
rename to Tests/Functional/ContentTypes/BaseContentTypeTesting.php
index c5652b29..fc7025f4 100644
--- a/Tests/Functional/ContentTypes/BaseContentTypeTest.php
+++ b/Tests/Functional/ContentTypes/BaseContentTypeTesting.php
@@ -11,9 +11,9 @@
namespace FriendsOfTYPO3\Headless\Tests\Functional\ContentTypes;
-use FriendsOfTYPO3\Headless\Tests\Functional\BaseTest;
+use FriendsOfTYPO3\Headless\Tests\Functional\BaseHeadlessTesting;
-class BaseContentTypeTest extends BaseTest
+abstract class BaseContentTypeTesting extends BaseHeadlessTesting
{
/**
* set up objects
@@ -22,7 +22,7 @@ public function setUp(): void
{
parent::setUp();
- $this->importDataSet(__DIR__ . '/../Fixtures/content.xml');
+ $this->importCSVDataSet(__DIR__ . '/../Fixtures/content.csv');
}
protected function checkDefaultContentFields($contentElement, $id, $pid, $type, $colPos = 0, $categories = '')
@@ -54,12 +54,12 @@ protected function checkHeaderFields($contentElement, $header = '', $subheader =
self::assertTrue(isset($contentElementContent['headerLink']), 'headerLink not set');
}
- protected function checkHeaderFieldsLink($contentElement, $linkText, $urlPrefix, $target)
+ protected function checkHeaderFieldsLink($contentElement, $link, $urlPrefix, $target)
{
$contentElementHeaderFieldsLink = $contentElement['content']['headerLink'];
self::assertIsArray($contentElementHeaderFieldsLink, 'headerLink not an array');
- self::assertEquals($linkText, $contentElementHeaderFieldsLink['linkText'], 'linkText mismatch');
+ self::assertEquals($link, $contentElementHeaderFieldsLink['linkText'], 'linkText mismatch');
self::assertStringStartsWith($urlPrefix, $contentElementHeaderFieldsLink['href'], 'url mismatch');
self::assertEquals($target, $contentElementHeaderFieldsLink['target'], 'target mismatch');
}
@@ -90,7 +90,7 @@ protected function checkGalleryContentFields($contentElement)
self::assertIsArray($contentElement['content']['gallery']['rows'][1]['columns'], 'rows.columns not set');
self::assertCount(1, $contentElement['content']['gallery']['rows'][1]['columns'], 'rows.columns count mismatch');
- $this->checkGalleryFile($contentElement['content']['gallery']['rows'][1]['columns'][1], '/typo3conf/ext/headless/ext_icon.gif', 'image/gif', 'MetadataTitle', 18, 16, null);
+ $this->checkGalleryFile($contentElement['content']['gallery']['rows'][1]['columns'][1], 'typo3conf/ext/headless/ext_icon.gif', 'image/gif', 'MetadataTitle', 18, 16, null);
}
protected function checkGalleryFile($fileElement, $originalUrl, $mimeType, $title, $width, $height, $autoplay)
diff --git a/Tests/Functional/ContentTypes/BasicListElementTest.php b/Tests/Functional/ContentTypes/BasicListElementTest.php
index 985170ba..535ddfe1 100644
--- a/Tests/Functional/ContentTypes/BasicListElementTest.php
+++ b/Tests/Functional/ContentTypes/BasicListElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class BasicListElementTest extends BaseContentTypeTest
+class BasicListElementTest extends BaseContentTypeTesting
{
public function testBasicListContentElement()
{
diff --git a/Tests/Functional/ContentTypes/BulletsElementTest.php b/Tests/Functional/ContentTypes/BulletsElementTest.php
index 3684bc85..ed3af242 100644
--- a/Tests/Functional/ContentTypes/BulletsElementTest.php
+++ b/Tests/Functional/ContentTypes/BulletsElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class BulletsElementTest extends BaseContentTypeTest
+class BulletsElementTest extends BaseContentTypeTesting
{
public function testBulletsContentElement()
{
diff --git a/Tests/Functional/ContentTypes/DefaultContentsTest.php b/Tests/Functional/ContentTypes/DefaultContentsTest.php
index 68fbca8e..c10a281e 100644
--- a/Tests/Functional/ContentTypes/DefaultContentsTest.php
+++ b/Tests/Functional/ContentTypes/DefaultContentsTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class DefaultContentsTest extends BaseContentTypeTest
+class DefaultContentsTest extends BaseContentTypeTesting
{
public function testContentStructure()
{
diff --git a/Tests/Functional/ContentTypes/DivElementTest.php b/Tests/Functional/ContentTypes/DivElementTest.php
index 011774a5..124355a5 100644
--- a/Tests/Functional/ContentTypes/DivElementTest.php
+++ b/Tests/Functional/ContentTypes/DivElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class DivElementTest extends BaseContentTypeTest
+class DivElementTest extends BaseContentTypeTesting
{
public function testDivContentElement()
{
diff --git a/Tests/Functional/ContentTypes/HeaderElementTest.php b/Tests/Functional/ContentTypes/HeaderElementTest.php
index 73eb00f6..97ad857b 100644
--- a/Tests/Functional/ContentTypes/HeaderElementTest.php
+++ b/Tests/Functional/ContentTypes/HeaderElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class HeaderElementTest extends BaseContentTypeTest
+class HeaderElementTest extends BaseContentTypeTesting
{
public function testHeaderContentElement()
{
diff --git a/Tests/Functional/ContentTypes/HtmlElementTest.php b/Tests/Functional/ContentTypes/HtmlElementTest.php
index f94111dd..a6ca5be8 100644
--- a/Tests/Functional/ContentTypes/HtmlElementTest.php
+++ b/Tests/Functional/ContentTypes/HtmlElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class HtmlElementTest extends BaseContentTypeTest
+class HtmlElementTest extends BaseContentTypeTesting
{
public function testHtmlContentElement()
{
diff --git a/Tests/Functional/ContentTypes/ImageElementTest.php b/Tests/Functional/ContentTypes/ImageElementTest.php
index b4021565..a799ac1a 100644
--- a/Tests/Functional/ContentTypes/ImageElementTest.php
+++ b/Tests/Functional/ContentTypes/ImageElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class ImageElementTest extends BaseContentTypeTest
+class ImageElementTest extends BaseContentTypeTesting
{
public function testImageContentElement()
{
diff --git a/Tests/Functional/ContentTypes/MenuAbstractPagesElementTest.php b/Tests/Functional/ContentTypes/MenuAbstractPagesElementTest.php
index 6bdc6658..797dfd4e 100644
--- a/Tests/Functional/ContentTypes/MenuAbstractPagesElementTest.php
+++ b/Tests/Functional/ContentTypes/MenuAbstractPagesElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class MenuAbstractPagesElementTest extends BaseContentTypeTest
+class MenuAbstractPagesElementTest extends BaseContentTypeTesting
{
public function testMenuContentElement()
{
diff --git a/Tests/Functional/ContentTypes/MenuCategorizedContentElementTest.php b/Tests/Functional/ContentTypes/MenuCategorizedContentElementTest.php
index 9b28180c..1aac8129 100644
--- a/Tests/Functional/ContentTypes/MenuCategorizedContentElementTest.php
+++ b/Tests/Functional/ContentTypes/MenuCategorizedContentElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class MenuCategorizedContentElementTest extends BaseContentTypeTest
+class MenuCategorizedContentElementTest extends BaseContentTypeTesting
{
public function testMenuContentElement()
{
diff --git a/Tests/Functional/ContentTypes/MenuCategorizedPagesElementTest.php b/Tests/Functional/ContentTypes/MenuCategorizedPagesElementTest.php
index 1ffa48dd..22c3c7d6 100644
--- a/Tests/Functional/ContentTypes/MenuCategorizedPagesElementTest.php
+++ b/Tests/Functional/ContentTypes/MenuCategorizedPagesElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class MenuCategorizedPagesElementTest extends BaseContentTypeTest
+class MenuCategorizedPagesElementTest extends BaseContentTypeTesting
{
public function testMenuContentElement()
{
diff --git a/Tests/Functional/ContentTypes/MenuPagesElementTest.php b/Tests/Functional/ContentTypes/MenuPagesElementTest.php
index f45682ad..5fcb33a0 100644
--- a/Tests/Functional/ContentTypes/MenuPagesElementTest.php
+++ b/Tests/Functional/ContentTypes/MenuPagesElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class MenuPagesElementTest extends BaseContentTypeTest
+class MenuPagesElementTest extends BaseContentTypeTesting
{
public function testMenuContentElement()
{
diff --git a/Tests/Functional/ContentTypes/MenuRecentlyUpdatedPagesElementTest.php b/Tests/Functional/ContentTypes/MenuRecentlyUpdatedPagesElementTest.php
index 0d39c1ee..dad36e9b 100644
--- a/Tests/Functional/ContentTypes/MenuRecentlyUpdatedPagesElementTest.php
+++ b/Tests/Functional/ContentTypes/MenuRecentlyUpdatedPagesElementTest.php
@@ -16,7 +16,7 @@
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class MenuRecentlyUpdatedPagesElementTest extends BaseContentTypeTest
+class MenuRecentlyUpdatedPagesElementTest extends BaseContentTypeTesting
{
public function setUp(): void
{
@@ -26,9 +26,17 @@ public function setUp(): void
$modifiedSevenDayAgo = (clone $currentDate)->modify('-7 day');
$modifiedEightDayAgo = (clone $currentDate)->modify('-8 day');
$connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('pages');
- $connection->prepare('update pages set SYS_LASTCHANGED = ? WHERE uid = 2')->execute([$modifiedOneDayAgo->getTimestamp()]);
- $connection->prepare('update pages set SYS_LASTCHANGED = ? WHERE uid = 3')->execute([$modifiedSevenDayAgo->getTimestamp()]);
- $connection->prepare('update pages set SYS_LASTCHANGED = ? WHERE uid = 4')->execute([$modifiedEightDayAgo->getTimestamp()]);
+ $sql = $connection->prepare('update pages set SYS_LASTCHANGED = :change WHERE uid = 2');
+ $sql->bindValue(':change', $modifiedOneDayAgo->getTimestamp());
+ $sql->executeStatement();
+
+ $sql = $connection->prepare('update pages set SYS_LASTCHANGED = :change WHERE uid = 3');
+ $sql->bindValue(':change', $modifiedSevenDayAgo->getTimestamp());
+ $sql->executeStatement();
+
+ $sql = $connection->prepare('update pages set SYS_LASTCHANGED = :change WHERE uid = 4');
+ $sql->bindValue(':change', $modifiedEightDayAgo->getTimestamp());
+ $sql->executeStatement();
}
public function testMenuContentElement()
diff --git a/Tests/Functional/ContentTypes/MenuRelatedPagesElementTest.php b/Tests/Functional/ContentTypes/MenuRelatedPagesElementTest.php
index 69720c43..1b07c95d 100644
--- a/Tests/Functional/ContentTypes/MenuRelatedPagesElementTest.php
+++ b/Tests/Functional/ContentTypes/MenuRelatedPagesElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class MenuRelatedPagesElementTest extends BaseContentTypeTest
+class MenuRelatedPagesElementTest extends BaseContentTypeTesting
{
public function testMenuContentElement()
{
diff --git a/Tests/Functional/ContentTypes/MenuSectionElementTest.php b/Tests/Functional/ContentTypes/MenuSectionElementTest.php
index 86f1574e..569d1aec 100644
--- a/Tests/Functional/ContentTypes/MenuSectionElementTest.php
+++ b/Tests/Functional/ContentTypes/MenuSectionElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class MenuSectionElementTest extends BaseContentTypeTest
+class MenuSectionElementTest extends BaseContentTypeTesting
{
public function testMenuContentElement()
{
diff --git a/Tests/Functional/ContentTypes/MenuSitemapElementTest.php b/Tests/Functional/ContentTypes/MenuSitemapElementTest.php
index d3f82498..54fe8d34 100644
--- a/Tests/Functional/ContentTypes/MenuSitemapElementTest.php
+++ b/Tests/Functional/ContentTypes/MenuSitemapElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class MenuSitemapElementTest extends BaseContentTypeTest
+class MenuSitemapElementTest extends BaseContentTypeTesting
{
public function testMenuContentElement()
{
diff --git a/Tests/Functional/ContentTypes/MenuSitemapSelectedPagesElementTest.php b/Tests/Functional/ContentTypes/MenuSitemapSelectedPagesElementTest.php
index c0a967f1..96800b47 100644
--- a/Tests/Functional/ContentTypes/MenuSitemapSelectedPagesElementTest.php
+++ b/Tests/Functional/ContentTypes/MenuSitemapSelectedPagesElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class MenuSitemapSelectedPagesElementTest extends BaseContentTypeTest
+class MenuSitemapSelectedPagesElementTest extends BaseContentTypeTesting
{
public function testMenuContentElement()
{
diff --git a/Tests/Functional/ContentTypes/MenuSubpagesElementTest.php b/Tests/Functional/ContentTypes/MenuSubpagesElementTest.php
index a3273314..a0b2205e 100644
--- a/Tests/Functional/ContentTypes/MenuSubpagesElementTest.php
+++ b/Tests/Functional/ContentTypes/MenuSubpagesElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class MenuSubpagesElementTest extends BaseContentTypeTest
+class MenuSubpagesElementTest extends BaseContentTypeTesting
{
public function testMenuSubpagesContentElement()
{
diff --git a/Tests/Functional/ContentTypes/ShortcutElementTest.php b/Tests/Functional/ContentTypes/ShortcutElementTest.php
index 159df9cc..5331c14e 100644
--- a/Tests/Functional/ContentTypes/ShortcutElementTest.php
+++ b/Tests/Functional/ContentTypes/ShortcutElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class ShortcutElementTest extends BaseContentTypeTest
+class ShortcutElementTest extends BaseContentTypeTesting
{
public function testShortcutContentElement()
{
diff --git a/Tests/Functional/ContentTypes/TableElementTest.php b/Tests/Functional/ContentTypes/TableElementTest.php
index ef641261..bc839dfb 100644
--- a/Tests/Functional/ContentTypes/TableElementTest.php
+++ b/Tests/Functional/ContentTypes/TableElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class TableElementTest extends BaseContentTypeTest
+class TableElementTest extends BaseContentTypeTesting
{
public function testTableContentElement()
{
diff --git a/Tests/Functional/ContentTypes/TextElementTest.php b/Tests/Functional/ContentTypes/TextElementTest.php
index 685fbebc..9cfa3c34 100644
--- a/Tests/Functional/ContentTypes/TextElementTest.php
+++ b/Tests/Functional/ContentTypes/TextElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class TextElementTest extends BaseContentTypeTest
+class TextElementTest extends BaseContentTypeTesting
{
public function testTextContentElement()
{
diff --git a/Tests/Functional/ContentTypes/TextMediaElementTest.php b/Tests/Functional/ContentTypes/TextMediaElementTest.php
index e3941843..3ebdc69d 100644
--- a/Tests/Functional/ContentTypes/TextMediaElementTest.php
+++ b/Tests/Functional/ContentTypes/TextMediaElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class TextMediaElementTest extends BaseContentTypeTest
+class TextMediaElementTest extends BaseContentTypeTesting
{
public function testTextMediaContentElement()
{
diff --git a/Tests/Functional/ContentTypes/TextpicElementTest.php b/Tests/Functional/ContentTypes/TextpicElementTest.php
index ef42108c..2d807660 100644
--- a/Tests/Functional/ContentTypes/TextpicElementTest.php
+++ b/Tests/Functional/ContentTypes/TextpicElementTest.php
@@ -13,7 +13,7 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class TextpicElementTest extends BaseContentTypeTest
+class TextpicElementTest extends BaseContentTypeTesting
{
public function testTextpicContentElement()
{
diff --git a/Tests/Functional/Fixtures/content.csv b/Tests/Functional/Fixtures/content.csv
new file mode 100644
index 00000000..3013b371
--- /dev/null
+++ b/Tests/Functional/Fixtures/content.csv
@@ -0,0 +1,55 @@
+tt_content,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,uid,pid,sorting,colPos,CType,space_before_class,space_after_class,frame_class,layout,categories,header,subheader,header_layout,header_position,header_link,bodytext,list_type,table_caption,table_delimiter,table_enclosure,table_class,table_tfoot,table_header_position,cols,bullets_type,records,image,assets,pages,selected_categories,category_field
+,1,1,1,0,text,SpaceBefore,SpaceAfter,Frame,1,1,Header,SubHeader,1,2,"t3://page?uid=2 _blank LinkClass LinkTitle parameter=999","
+
Link
+ ",,,,,,,,,,,,,,,
+,3,1,2,0,header,SpaceBefore,SpaceAfter,Frame,1,1,Header,SubHeader,1,2,"t3://page?uid=2 _blank LinkClass LinkTitle parameter=999",,,,,,,,,,,,,,,,
+,4,1,3,0,html,SpaceBefore,SpaceAfter,Frame,1,1,Header,SubHeader,1,2,"t3://page?uid=2 _blank LinkClass LinkTitle parameter=999","Link",,,,,,,,,,,,,,,
+,5,1,4,0,div,SpaceBefore,SpaceAfter,Frame,1,1,Header,SubHeader,1,2,"t3://page?uid=2 _blank LinkClass LinkTitle parameter=999","Link",,,,,,,,,,,,,,,
+,6,1,5,0,list,SpaceBefore,SpaceAfter,Frame,1,1,Header,SubHeader,1,2,"t3://page?uid=2 _blank LinkClass LinkTitle parameter=999","Link",BasicList,,,,,,,,,,,,,,
+,7,1,6,0,table,SpaceBefore,SpaceAfter,Frame,1,1,Header,SubHeader,1,2,"t3://page?uid=2 _blank LinkClass LinkTitle parameter=999","""Cell1.1"";""Cell1.2"";""Cell1.3"";""Cell1.4""
+""Cell2.1"";"""";"""";""""
+""Cell3.1"";"""";"""";""""
+"""""""";"""";"""";""""",,TableCaption,59,34,striped,1,1,6,,,,,,,
+,8,1,7,0,bullets,SpaceBefore,SpaceAfter,Frame,1,1,Header,SubHeader,1,2,"t3://page?uid=2 _blank LinkClass LinkTitle parameter=999","Top1
+Top2
+Top3",,,,,,,,,1,,,,,,
+,9,1,8,0,shortcut,SpaceBefore,SpaceAfter,Frame,1,1,Header,SubHeader,1,2,"t3://page?uid=2 _blank LinkClass LinkTitle parameter=999",,,,,,,,,,,"pages_1,tt_content_2,tt_content_1",,,,,
+,2,1,1,1,textmedia,,,default,,,,,,,,"Link",,,,,,,,,,,1,,,,
+,10,1,1,1,image,,,default,,,,,,,,,,,,,,,,,,,,1,,,
+,11,1,1,1,textpic,,,default,,,,,,,,"Link",,,,,,,,,,,1,,,,
+,12,1,1,1,menu_subpages,SpaceBefore,SpaceAfter,default,,1,Header,SubHeader,0,2,,,,,,,,,,,,,,,,,
+,13,1,1,1,menu_sitemap,SpaceBefore,SpaceAfter,default,,1,Header,SubHeader,0,2,,,,,,,,,,,,,,,"1,2,3",,
+,14,1,1,1,menu_pages,SpaceBefore,SpaceAfter,default,,1,Header,SubHeader,0,2,,,,,,,,,,,,,,,"1,2,3,4",,
+,15,1,1,1,menu_section,SpaceBefore,SpaceAfter,default,,1,Header,SubHeader,0,2,,,,,,,,,,,,,,,"1,4",,
+,16,1,1,1,menu_recently_updated,SpaceBefore,SpaceAfter,default,,1,Header,SubHeader,0,2,,,,,,,,,,,,,,,1,,
+,17,1,1,1,header,,,default,,3,,,,,,,,,,,,,,,,,,,,,
+,18,1,1,1,textpic,,,default,,3,,,,,,,,,,,,,,,,,,,,,
+,19,1,1,1,menu_categorized_content,SpaceBefore,SpaceAfter,default,,3,Header,SubHeader,0,2,,,,,,,,,,,,,,,,3,categories
+,20,2,1,1,menu_categorized_pages,SpaceBefore,SpaceAfter,default,,1,Header,SubHeader,0,2,,,,,,,,,,,,,,,,3,categories
+,21,5,1,1,menu_sitemap_pages,SpaceBefore,SpaceAfter,default,,1,Header,SubHeader,0,2,,,,,,,,,,,,,,,5,,
+,22,1,1,1,menu_related_pages,SpaceBefore,SpaceAfter,default,,1,Header,SubHeader,0,2,,,,,,,,,,,,,,,,,
+,23,1,1,1,menu_abstract,SpaceBefore,SpaceAfter,default,,1,Header,SubHeader,0,2,,,,,,,,,,,,,,,5,,
+sys_category,,,
+,uid,pid,title
+,1,0,SysCategory1Title
+,2,0,SysCategory2Title
+,3,0,SysCategory3Title
+sys_category_record_mm,,,,,,
+,tablenames,uid_foreign,uid_local,fieldname,sorting,sorting_foreign
+,tt_content,1,1,categories,,
+,tt_content,1,2,categories,,
+,pages,5,3,categories,,
+,tt_content,17,3,categories,1,0
+,tt_content,18,3,categories,1,0
+sys_file,,,,,,,,,,,,,,
+,uid,pid,storage,type,identifier,identifier_hash,folder_hash,extension,mime_type,name,sha1,size,creation_date,modification_date
+,1,0,0,1,/typo3conf/ext/headless/ext_icon.gif,ae03df120da87352822f4aae6d476086cb8c0cf8,85051482e1ba204348a9b9f6c1a37069e77de027,gif,image/gif,ext_icon.gif,4a53ba5b5a156b82e3efd443f9a402f8c6e6dd08,177,1400176659,1400176659
+sys_file_metadata,,,,,,
+,uid,pid,file,title,width,height
+,1,0,1,MetadataTitle,18,16
+sys_file_reference,,,,,,,
+,uid,pid,uid_local,uid_foreign,tablenames,fieldname,autoplay
+,1,1,1,2,tt_content,assets,1
+,2,1,1,10,tt_content,image,1
+,3,1,1,11,tt_content,image,1
diff --git a/Tests/Functional/Fixtures/content.xml b/Tests/Functional/Fixtures/content.xml
deleted file mode 100644
index 3ada8520..00000000
--- a/Tests/Functional/Fixtures/content.xml
+++ /dev/null
@@ -1,455 +0,0 @@
-
-
-
- 1
- 1
- 1
- 0
- text
- SpaceBefore
- SpaceAfter
- Frame
- 1
- 1
-
- SubHeader
- 1
- 2
- t3://page?uid=2 _blank LinkClass LinkTitle parameter=999
- Link
- ]]>
-
-
- 3
- 1
- 2
- 0
- header
- SpaceBefore
- SpaceAfter
- Frame
- 1
- 1
-
- SubHeader
- 1
- 2
- t3://page?uid=2 _blank LinkClass LinkTitle parameter=999
-
-
- 4
- 1
- 3
- 0
- html
- SpaceBefore
- SpaceAfter
- Frame
- 1
- 1
-
- SubHeader
- 1
- 2
- t3://page?uid=2 _blank LinkClass LinkTitle parameter=999
- Link]]>
-
-
- 5
- 1
- 4
- 0
- div
- SpaceBefore
- SpaceAfter
- Frame
- 1
- 1
-
- SubHeader
- 1
- 2
- t3://page?uid=2 _blank LinkClass LinkTitle parameter=999
- Link]]>
-
-
- 6
- 1
- 5
- 0
- list
- BasicList
- SpaceBefore
- SpaceAfter
- Frame
- 1
- 1
-
- SubHeader
- 1
- 2
- t3://page?uid=2 _blank LinkClass LinkTitle parameter=999
- Link]]>
-
-
- 7
- 1
- 6
- 0
- table
- SpaceBefore
- SpaceAfter
- Frame
- 1
- 1
-
- SubHeader
- 1
- 2
- t3://page?uid=2 _blank LinkClass LinkTitle parameter=999
- TableCaption
- 59
- 34
- striped
- 1
- 1
- 6
-
-
-
- 8
- 1
- 7
- 0
- bullets
- SpaceBefore
- SpaceAfter
- Frame
- 1
- 1
-
- SubHeader
- 1
- 2
- t3://page?uid=2 _blank LinkClass LinkTitle parameter=999
- 1
-
-
-
- 9
- 1
- 8
- 0
- shortcut
- SpaceBefore
- SpaceAfter
- Frame
- 1
- 1
-
- SubHeader
- 1
- 2
- t3://page?uid=2 _blank LinkClass LinkTitle parameter=999
- pages_1,tt_content_2,tt_content_1
-
-
- 2
- 1
- 1
- 1
- textmedia
- 1
- Link]]>
-
-
- 10
- 1
- 1
- 1
- image
- 1
-
-
- 11
- 1
- 1
- 1
- textpic
- 1
- Link]]>
-
-
- 12
- 1
- 1
- 1
- menu_subpages
- SpaceBefore
- SpaceAfter
- 1
-
- SubHeader
- 0
- 2
-
-
- 13
- 1
- 1
- 1
- menu_sitemap
- SpaceBefore
- SpaceAfter
- 1
-
- SubHeader
- 0
- 2
- 1,2,3
-
-
- 14
- 1
- 1
- 1
- menu_pages
- SpaceBefore
- SpaceAfter
- 1
-
- SubHeader
- 0
- 2
- 1,2,3,4
-
-
- 15
- 1
- 1
- 1
- menu_section
- SpaceBefore
- SpaceAfter
- 1
-
- SubHeader
- 0
- 2
- 1,4
-
-
- 16
- 1
- 1
- 1
- menu_recently_updated
- SpaceBefore
- SpaceAfter
- 1
-
- SubHeader
- 0
- 2
- 1
-
-
- 17
- 1
- 1
- 1
- header
- 3
-
-
- 18
- 1
- 1
- 1
- textpic
- 3
-
-
- 19
- 1
- 1
- 1
- menu_categorized_content
- 3
- 3
- categories
- SpaceBefore
- SpaceAfter
-
- SubHeader
- 0
- 2
-
-
- 20
- 2
- 1
- 1
- menu_categorized_pages
- SpaceBefore
- SpaceAfter
- 1
- 3
- categories
-
- SubHeader
- 0
- 2
-
-
- 21
- 5
- 1
- 1
- menu_sitemap_pages
- SpaceBefore
- SpaceAfter
- 1
-
- SubHeader
- 0
- 2
- 5
-
-
- 22
- 1
- 1
- 1
- menu_related_pages
- SpaceBefore
- SpaceAfter
- 1
-
- SubHeader
- 0
- 2
-
-
- 23
- 1
- 1
- 1
- menu_abstract
- SpaceBefore
- SpaceAfter
- 1
-
- SubHeader
- 0
- 2
- 5
-
-
- 1
- 0
- SysCategory1Title
-
-
- 2
- 0
- SysCategory2Title
-
-
- 3
- 0
- SysCategory3Title
-
-
- tt_content
- 1
- 1
- categories
-
-
- tt_content
- 1
- 2
- categories
-
-
- pages
- 5
- 3
- categories
-
-
- tt_content
- 17
- 3
- categories
- 1
- 0
-
-
- tt_content
- 18
- 3
- categories
- 1
- 0
-
-
- 1
- 0
- 0
- 1
- /typo3conf/ext/headless/ext_icon.gif
- ae03df120da87352822f4aae6d476086cb8c0cf8
- 85051482e1ba204348a9b9f6c1a37069e77de027
- gif
- image/gif
- ext_icon.gif
- 4a53ba5b5a156b82e3efd443f9a402f8c6e6dd08
- 177
- 1400176659
- 1400176659
-
-
- 1
- 0
- 1
- MetadataTitle
- 18
- 16
-
-
- 1
- 1
- 1
- 2
- tt_content
- assets
- 1
-
-
- 2
- 1
- 1
- 10
- tt_content
- image
- 1
-
-
- 3
- 1
- 1
- 11
- tt_content
- image
- 1
-
-
-
\ No newline at end of file
diff --git a/Tests/Functional/Fixtures/pages.csv b/Tests/Functional/Fixtures/pages.csv
new file mode 100644
index 00000000..3eaa70e2
--- /dev/null
+++ b/Tests/Functional/Fixtures/pages.csv
@@ -0,0 +1,12 @@
+"pages",,,,,,,,
+,uid,pid,title,slug,deleted,perms_everybody,keywords,abstract
+,1,0,"Root","/",0,15,"test",
+,2,1,"Page 1","/page1",0,15,,
+,3,2,"Page 1.1","/page1/page1_1",0,15,,
+,4,1,"Page 2","/page2",0,15,,
+,5,1,"Page 3","/page3",0,15,,"Test"
+,6,5,"Page 4","/page4",0,15,,"Test"
+,7,6,"Page 5","/page5",0,15,,,
+,8,1,"Page 8","/page8",0,15,"test",,
+,9,1,"Page 9","/page9",0,15,"test",,
+,10,9,"Page 10","/page10",0,15,"test",,
diff --git a/Tests/Functional/Fixtures/pages.xml b/Tests/Functional/Fixtures/pages.xml
deleted file mode 100644
index 92d914b3..00000000
--- a/Tests/Functional/Fixtures/pages.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
- 1
- 0
- Root
- /
- 0
- 15
- test
-
-
- 2
- 1
- Page 1
- /page1
- 0
- 15
-
-
- 3
- 2
- Page 1.1
- /page1/page1_1
- 0
- 15
-
-
- 4
- 1
- Page 2
- /page2
- 0
- 15
-
-
- 5
- 1
- Page 3
- /page3
- 0
- Test
- 15
-
-
- 6
- 5
- Page 4
- /page4
- 0
- Test
- 15
-
-
- 7
- 6
- Page 5
- /page5
- 0
- 15
-
-
- 8
- 1
- Page 8
- /page8
- 0
- 15
- test
-
-
- 9
- 1
- Page 9
- /page9
- 0
- 15
- test
-
-
- 10
- 9
- Page 10
- /page10
- 0
- 15
- test
-
-
\ No newline at end of file
diff --git a/Tests/Functional/PageTypes/BasePageTypesTest.php b/Tests/Functional/PageTypes/BasePageTypesHeadlessTesting.php
similarity index 92%
rename from Tests/Functional/PageTypes/BasePageTypesTest.php
rename to Tests/Functional/PageTypes/BasePageTypesHeadlessTesting.php
index e485aebf..21a0608a 100644
--- a/Tests/Functional/PageTypes/BasePageTypesTest.php
+++ b/Tests/Functional/PageTypes/BasePageTypesHeadlessTesting.php
@@ -11,13 +11,13 @@
namespace FriendsOfTYPO3\Headless\Tests\Functional\PageTypes;
-use FriendsOfTYPO3\Headless\Tests\Functional\BaseTest;
+use FriendsOfTYPO3\Headless\Tests\Functional\BaseHeadlessTesting;
use JsonSchema\SchemaStorage;
use JsonSchema\Uri\UriRetriever;
use JsonSchema\Validator;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-class BasePageTypesTest extends BaseTest
+abstract class BasePageTypesHeadlessTesting extends BaseHeadlessTesting
{
/**
* @param string $jsonString
diff --git a/Tests/Functional/PageTypes/SchemaPageTypesTest.php b/Tests/Functional/PageTypes/SchemaPageTypesTest.php
index 621adf9d..ddb003db 100644
--- a/Tests/Functional/PageTypes/SchemaPageTypesTest.php
+++ b/Tests/Functional/PageTypes/SchemaPageTypesTest.php
@@ -13,12 +13,9 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class SchemaPageTypesTest extends BasePageTypesTest
+class SchemaPageTypesTest extends BasePageTypesHeadlessTesting
{
- /**
- * @test
- */
- public function getMenu()
+ public function testGetMenu()
{
$response = $this->executeFrontendSubRequest(
new InternalRequest('https://website.local/?type=834')
@@ -27,10 +24,7 @@ public function getMenu()
self::assertEquals(200, $response->getStatusCode());
}
- /**
- * @test
- */
- public function getPage()
+ public function testGetPage()
{
$response = $this->executeFrontendSubRequest(
new InternalRequest('https://website.local/')
diff --git a/Tests/Functional/PageTypes/StructurePageTypesTest.php b/Tests/Functional/PageTypes/StructurePageTypesTest.php
index bfa7993e..c33eeb8f 100644
--- a/Tests/Functional/PageTypes/StructurePageTypesTest.php
+++ b/Tests/Functional/PageTypes/StructurePageTypesTest.php
@@ -13,12 +13,9 @@
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
-class StructurePageTypesTest extends BasePageTypesTest
+class StructurePageTypesTest extends BasePageTypesHeadlessTesting
{
- /**
- * @test
- */
- public function getMenuStructure()
+ public function testGetMenuStructure()
{
$response = $this->executeFrontendSubRequest(
new InternalRequest('https://website.local/?type=834')
diff --git a/Tests/Functional/phpunit.xml b/Tests/Functional/phpunit.xml
index 71c525ec..5502063c 100644
--- a/Tests/Functional/phpunit.xml
+++ b/Tests/Functional/phpunit.xml
@@ -1,24 +1,18 @@
-
-
-
- ../../Classes
-
-
./
@@ -29,4 +23,9 @@
+
diff --git a/Tests/Unit/ContentObject/BooleanContentObjectTest.php b/Tests/Unit/ContentObject/BooleanContentObjectTest.php
index e5d1c3b1..5bd49414 100644
--- a/Tests/Unit/ContentObject/BooleanContentObjectTest.php
+++ b/Tests/Unit/ContentObject/BooleanContentObjectTest.php
@@ -12,6 +12,7 @@
namespace FriendsOfTYPO3\Headless\Tests\Unit\ContentObject;
use FriendsOfTYPO3\Headless\ContentObject\BooleanContentObject;
+use PHPUnit\Framework\Attributes\DataProvider;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
@@ -21,10 +22,7 @@ class BooleanContentObjectTest extends UnitTestCase
{
use ProphecyTrait;
- /**
- * @test
- */
- public function renderTest()
+ public function testRender()
{
$cObj = $this->createMock(ContentObjectRenderer::class);
$cObj->setRequest(new ServerRequest());
@@ -36,11 +34,8 @@ public function renderTest()
self::assertFalse($contentObject->render());
}
- /**
- * @test
- * @dataProvider dataProvider
- */
- public function renderWithProviderTest($argument, bool $result)
+ #[DataProvider('dataProvider')]
+ public function testRenderWithProvider($argument, bool $result): void
{
$cObj = $this->createMock(ContentObjectRenderer::class);
$cObj->setRequest(new ServerRequest());
diff --git a/Tests/Unit/ContentObject/FloatContentObjectTest.php b/Tests/Unit/ContentObject/FloatContentObjectTest.php
index 5ea09d01..52b30af2 100644
--- a/Tests/Unit/ContentObject/FloatContentObjectTest.php
+++ b/Tests/Unit/ContentObject/FloatContentObjectTest.php
@@ -12,16 +12,16 @@
namespace FriendsOfTYPO3\Headless\Tests\Unit\ContentObject;
use FriendsOfTYPO3\Headless\ContentObject\FloatContentObject;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Test;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
class FloatContentObjectTest extends UnitTestCase
{
- /**
- * @test
- */
- public function renderTest()
+ #[Test]
+ public function render(): void
{
$cObj = $this->createMock(ContentObjectRenderer::class);
$cObj->setRequest(new ServerRequest());
@@ -32,11 +32,8 @@ public function renderTest()
self::assertEquals(0.0, $contentObject->render());
}
- /**
- * @test
- * @dataProvider dataProvider
- */
- public function renderWithProviderTest($argument, float $result)
+ #[Test,DataProvider('dataProvider')]
+ public function renderWithProvider($argument, float $result): void
{
$cObj = $this->createMock(ContentObjectRenderer::class);
$cObj->setRequest(new ServerRequest());
diff --git a/Tests/Unit/ContentObject/IntegerContentObjectTest.php b/Tests/Unit/ContentObject/IntegerContentObjectTest.php
index 662b6c33..f84e2d5e 100644
--- a/Tests/Unit/ContentObject/IntegerContentObjectTest.php
+++ b/Tests/Unit/ContentObject/IntegerContentObjectTest.php
@@ -12,6 +12,8 @@
namespace FriendsOfTYPO3\Headless\Tests\Unit\ContentObject;
use FriendsOfTYPO3\Headless\ContentObject\IntegerContentObject;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Test;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
@@ -21,10 +23,8 @@ class IntegerContentObjectTest extends UnitTestCase
{
use ProphecyTrait;
- /**
- * @test
- */
- public function renderTest()
+ #[Test]
+ public function render(): void
{
$cObj = $this->createMock(ContentObjectRenderer::class);
$cObj->setRequest(new ServerRequest());
@@ -35,11 +35,8 @@ public function renderTest()
self::assertEquals(0, $contentObject->render());
}
- /**
- * @test
- * @dataProvider dataProvider
- */
- public function renderWithProviderTest($argument, int $result)
+ #[Test, DataProvider('dataProvider')]
+ public function renderWithProvider($argument, int $result): void
{
$cObj = $this->createMock(ContentObjectRenderer::class);
$cObj->setRequest(new ServerRequest());
diff --git a/Tests/Unit/ContentObject/JsonContentObjectTest.php b/Tests/Unit/ContentObject/JsonContentObjectTest.php
index 4cef81e7..dd041fc7 100644
--- a/Tests/Unit/ContentObject/JsonContentObjectTest.php
+++ b/Tests/Unit/ContentObject/JsonContentObjectTest.php
@@ -16,6 +16,7 @@
use FriendsOfTYPO3\Headless\ContentObject\IntegerContentObject;
use FriendsOfTYPO3\Headless\ContentObject\JsonContentContentObject;
use FriendsOfTYPO3\Headless\ContentObject\JsonContentObject;
+use PHPUnit\Framework\Attributes\DataProvider;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\EventDispatcher\EventDispatcherInterface;
@@ -140,19 +141,13 @@ protected function setUp(): void
$this->contentObject->setContentObjectRenderer($contentObjectRenderer);
}
- /**
- * @test
- */
- public function renderTest()
+ public function testRender()
{
self::assertEquals('[]', $this->contentObject->render());
}
- /**
- * @test
- * @dataProvider dataProvider
- */
- public function renderWithProviderTest($argument, $result)
+ #[DataProvider('dataProvider')]
+ public function testRenderWithProvider($argument, $result)
{
self::assertEquals($result, $this->contentObject->render($argument));
}
diff --git a/Tests/Unit/DataProcessing/DataProcessingTraitTest.php b/Tests/Unit/DataProcessing/DataProcessingTraitTest.php
index 8019b4f2..e703f63a 100644
--- a/Tests/Unit/DataProcessing/DataProcessingTraitTest.php
+++ b/Tests/Unit/DataProcessing/DataProcessingTraitTest.php
@@ -12,15 +12,13 @@
namespace FriendsOfTYPO3\Headless\Tests\Unit\DataProcessing;
use FriendsOfTYPO3\Headless\DataProcessing\DataProcessingTrait;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class DataProcessingTraitTest extends TestCase
{
- /**
- * @test
- * @dataProvider dataProvider
- */
- public function removeDataIfnotAppendInConfigurationTest(
+ #[DataProvider('dataProvider')]
+ public function testRemoveDataIfnotAppendInConfiguration(
$expected,
array $processorConfiguration,
array $processedData
@@ -37,10 +35,7 @@ public function removeDataIfnotAppendInConfigurationTest(
);
}
- /**
- * @test
- */
- public function removeDataIfnotAppendInConfigurationAsMenuProcessorTest()
+ public function testRemoveDataIfnotAppendInConfigurationAsMenuProcessor()
{
$trait = new class () {
use DataProcessingTrait {
diff --git a/Tests/Unit/DataProcessing/DatabaseQueryProcessorTest.php b/Tests/Unit/DataProcessing/DatabaseQueryProcessorTest.php
index ef93d28e..65d1a8bb 100644
--- a/Tests/Unit/DataProcessing/DatabaseQueryProcessorTest.php
+++ b/Tests/Unit/DataProcessing/DatabaseQueryProcessorTest.php
@@ -61,10 +61,7 @@ protected function setUp(): void
parent::setUp();
}
- /**
- * @test
- */
- public function returnEarlyDueToIfStatementReturnsFalse(): void
+ public function testReturnEarlyDueToIfStatementReturnsFalse(): void
{
$processorConfiguration = [
'if.' => [
@@ -77,10 +74,7 @@ public function returnEarlyDueToIfStatementReturnsFalse(): void
self::assertEquals($processedData, $this->subject->process($this->contentObjectRenderer->reveal(), [], $processorConfiguration, $processedData));
}
- /**
- * @test
- */
- public function returnEarlyNoTableIsGiven(): void
+ public function testReturnEarlyNoTableIsGiven(): void
{
$processorConfiguration = [
'if.' => [
@@ -93,10 +87,7 @@ public function returnEarlyNoTableIsGiven(): void
self::assertEquals($processedData, $this->subject->process($this->contentObjectRenderer->reveal(), [], $processorConfiguration, $processedData));
}
- /**
- * @test
- */
- public function processWithoutAdditionalFields(): void
+ public function testProcessWithoutAdditionalFields(): void
{
$processorConfiguration = [
'table' => 'tt_content',
@@ -131,10 +122,7 @@ public function processWithoutAdditionalFields(): void
self::assertEquals($processedData, $this->subject->process($this->contentObjectRenderer->reveal(), [], $processorConfiguration, $processedData));
}
- /**
- * @test
- */
- public function processWithAdditionalFields(): void
+ public function testProcessWithAdditionalFields(): void
{
$processorConfiguration = [
'table' => 'tt_content',
diff --git a/Tests/Unit/DataProcessing/RootSiteProcessing/DomainSchemaTest.php b/Tests/Unit/DataProcessing/RootSiteProcessing/DomainSchemaTest.php
index c9cd1751..f7db61da 100644
--- a/Tests/Unit/DataProcessing/RootSiteProcessing/DomainSchemaTest.php
+++ b/Tests/Unit/DataProcessing/RootSiteProcessing/DomainSchemaTest.php
@@ -33,10 +33,7 @@ class DomainSchemaTest extends UnitTestCase
{
use ProphecyTrait;
- /**
- * @test
- */
- public function processTest()
+ public function testProcess(): void
{
$testUri = new Uri('https://test.domain.tld');
$cObj = $this->prophesize(ContentObjectRenderer::class);
@@ -133,17 +130,20 @@ protected function getUrlUtility($site = null): UrlUtility
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $mock = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
+ $mock->method('getSiteByPageId')->willReturn($site);
if ($site === null) {
$site = $this->getSiteWithBase($uri);
}
- $siteFinder->getSiteByPageId(Argument::is(1))->willReturn($site);
+ $mock->method('getSiteByPageId')->willReturn($site);
+
+ //$siteFinder->getSiteByPageId(Argument::is(1))->willReturn($site);
$dummyRequest = (new ServerRequest())->withAttribute('site', $site);
$dummyRequest = $dummyRequest->withAttribute('headless', new Headless());
- return new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), $dummyRequest, (new HeadlessMode())->withRequest($dummyRequest));
+ return new UrlUtility(null, $resolver->reveal(), $mock, $dummyRequest, (new HeadlessMode())->withRequest($dummyRequest));
}
protected function getSiteWithBase(UriInterface $uri, $withLanguage = null)
diff --git a/Tests/Unit/DataProcessing/RootSitesProcessorTest.php b/Tests/Unit/DataProcessing/RootSitesProcessorTest.php
index 8e488dd1..dd657c33 100644
--- a/Tests/Unit/DataProcessing/RootSitesProcessorTest.php
+++ b/Tests/Unit/DataProcessing/RootSitesProcessorTest.php
@@ -33,10 +33,7 @@ protected function setUp(): void
parent::setUp();
}
- /**
- * @test
- */
- public function customImplementation(): void
+ public function testCustomImplementation(): void
{
$processor = new RootSitesProcessor();
@@ -72,10 +69,7 @@ public function customImplementation(): void
], $processor->process($contentObjectRenderer, [], $conf, []));
}
- /**
- * @test
- */
- public function objectNotSet()
+ public function testObjectNotSet()
{
$processor = new RootSitesProcessor();
@@ -87,10 +81,7 @@ public function objectNotSet()
self::assertEquals([], $processor->process($contentObjectRenderer, [], $conf, []));
}
- /**
- * @test
- */
- public function featureEnabledButWrongSiteProvider(): void
+ public function testFeatureEnabledButWrongSiteProvider(): void
{
$processor = new RootSitesProcessor();
@@ -104,10 +95,7 @@ public function featureEnabledButWrongSiteProvider(): void
self::assertEquals([], $processor->process($contentObjectRenderer, [], $conf, []));
}
- /**
- * @test
- */
- public function featureEnabledButWrongSiteSchema(): void
+ public function testFeatureEnabledButWrongSiteSchema(): void
{
$processor = new RootSitesProcessor();
diff --git a/Tests/Unit/Event/Listener/AfterLinkIsGeneratedListenerTest.php b/Tests/Unit/Event/Listener/AfterLinkIsGeneratedListenerTest.php
index 318741da..5f7b4d51 100644
--- a/Tests/Unit/Event/Listener/AfterLinkIsGeneratedListenerTest.php
+++ b/Tests/Unit/Event/Listener/AfterLinkIsGeneratedListenerTest.php
@@ -34,14 +34,14 @@ public function test__construct()
{
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createPartialMock(SiteFinder::class, []);
$listener = new AfterLinkIsGeneratedListener(
$this->prophesize(Logger::class)->reveal(),
- new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal()),
+ new UrlUtility(null, $resolver->reveal(), $siteFinder),
$this->prophesize(LinkService::class)->reveal(),
new TypoLinkCodecService($this->prophesize(EventDispatcherInterface::class)->reveal()),
- $this->prophesize(SiteFinder::class)->reveal()
+ $siteFinder
);
self::assertInstanceOf(AfterLinkIsGeneratedListener::class, $listener);
@@ -51,14 +51,14 @@ public function test__invokeNotModifingAnything()
{
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createMock(SiteFinder::class);
$listener = new AfterLinkIsGeneratedListener(
$this->prophesize(Logger::class)->reveal(),
- new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal()),
+ new UrlUtility(null, $resolver->reveal(), $siteFinder),
$this->prophesize(LinkService::class)->reveal(),
new TypoLinkCodecService($this->prophesize(EventDispatcherInterface::class)->reveal()),
- $this->prophesize(SiteFinder::class)->reveal()
+ $siteFinder
);
$site = new Site('test', 1, []);
@@ -111,7 +111,7 @@ public function test__invokeModifingFromPageUid()
$urlUtility->reveal(),
$this->prophesize(LinkService::class)->reveal(),
new TypoLinkCodecService($this->prophesize(EventDispatcherInterface::class)->reveal()),
- $this->prophesize(SiteFinder::class)->reveal()
+ $this->createMock(SiteFinder::class)
);
$linkResult = new LinkResult('page', '/');
@@ -148,7 +148,7 @@ public function test__invokeModifingExternalSite()
$urlUtility->reveal(),
$linkService->reveal(),
new TypoLinkCodecService($this->prophesize(EventDispatcherInterface::class)->reveal()),
- $this->prophesize(SiteFinder::class)->reveal()
+ $this->createMock(SiteFinder::class)
);
$linkResult = new LinkResult('page', '/');
$linkResult = $linkResult->withLinkConfiguration(['parameter.' => ['data' => 'parameters:href']]);
@@ -182,8 +182,8 @@ public function test__SitemapLink()
$request = (new ServerRequest())->withAttribute('site', $site);
$cObj->getRequest()->willReturn($request);
- $siteFinder = $this->prophesize(SiteFinder::class);
- $siteFinder->getSiteByPageId(Argument::any())->willReturn($site);
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
+ $siteFinder->method('getSiteByPageId')->willReturn($site);
$urlUtility->withRequest($request)->willReturn($urlUtility->reveal());
@@ -195,7 +195,7 @@ public function test__SitemapLink()
$urlUtility->reveal(),
$linkService->reveal(),
new TypoLinkCodecService($eventDispatcher->reveal()),
- $siteFinder->reveal()
+ $siteFinder
);
$linkResult = new LinkResult('page', 'https://typo3.tld/sitemap-type/pages/sitemap.xml');
diff --git a/Tests/Unit/Event/Listener/AfterPagePreviewUriGeneratedListenerTest.php b/Tests/Unit/Event/Listener/AfterPagePreviewUriGeneratedListenerTest.php
index a32090a3..a78bd93c 100644
--- a/Tests/Unit/Event/Listener/AfterPagePreviewUriGeneratedListenerTest.php
+++ b/Tests/Unit/Event/Listener/AfterPagePreviewUriGeneratedListenerTest.php
@@ -33,13 +33,13 @@ public function test__construct()
{
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createMock(SiteFinder::class);
$listener = new AfterPagePreviewUriGeneratedListener(new UrlUtility(
null,
$resolver->reveal(),
- $siteFinder->reveal()
- ), $siteFinder->reveal());
+ $siteFinder
+ ), $siteFinder);
self::assertInstanceOf(AfterPagePreviewUriGeneratedListener::class, $listener);
}
@@ -48,14 +48,14 @@ public function testLink()
{
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
- $siteFinder->getSiteByPageId(Argument::any())->willReturn($site = new Site('test', 1, ['headless' => HeadlessMode::MIXED, 'frontendBase' => 'https://front.test.tld', 'base' => 'https://test.tld']));
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
+ $siteFinder->method('getSiteByPageId')->willReturn($site = new Site('test', 1, ['headless' => HeadlessMode::MIXED, 'frontendBase' => 'https://front.test.tld', 'base' => 'https://test.tld']));
$listener = new AfterPagePreviewUriGeneratedListener(new UrlUtility(
null,
$resolver->reveal(),
- $siteFinder->reveal()
- ), $siteFinder->reveal());
+ $siteFinder
+ ), $siteFinder);
$event = new AfterPagePreviewUriGeneratedEvent(
new Uri('https://test.tld/page'),
@@ -82,14 +82,14 @@ public function testSiteNotFound()
{
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
- $siteFinder->getSiteByPageId(Argument::any())->willThrow(new SiteNotFoundException());
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
+ $siteFinder->method('getSiteByPageId')->willThrowException(new SiteNotFoundException());
$listener = new AfterPagePreviewUriGeneratedListener(new UrlUtility(
null,
$resolver->reveal(),
- $siteFinder->reveal()
- ), $siteFinder->reveal());
+ $siteFinder
+ ), $siteFinder);
$event = new AfterPagePreviewUriGeneratedEvent(
new Uri('https://test.tld/page'),
diff --git a/Tests/Unit/Event/Listener/RedirectUrlAdditionalParamsListenerTest.php b/Tests/Unit/Event/Listener/RedirectUrlAdditionalParamsListenerTest.php
index d3fe7e6a..33b320a8 100644
--- a/Tests/Unit/Event/Listener/RedirectUrlAdditionalParamsListenerTest.php
+++ b/Tests/Unit/Event/Listener/RedirectUrlAdditionalParamsListenerTest.php
@@ -36,10 +36,7 @@ class RedirectUrlAdditionalParamsListenerTest extends UnitTestCase
{
use ProphecyTrait;
- /**
- * @test
- */
- public function invokeTest()
+ public function testInvoke(): void
{
$eventDispatcher = $this->prophesize(EventDispatcherInterface::class);
$eventDispatcher->dispatch(Argument::any())->willReturnArgument();
@@ -132,10 +129,7 @@ public function invokeTest()
self::assertSame((string)$expectedUri, $newRedirectEvent->getTargetUrl());
}
- /**
- * @test
- */
- public function invokeWithLanguageTest()
+ public function testInvokeWithLanguaget(): void
{
$eventDispatcher = $this->prophesize(EventDispatcherInterface::class);
$eventDispatcher->dispatch(Argument::any())->willReturnArgument();
@@ -246,14 +240,14 @@ protected function getUrlUtility($site = null): UrlUtility
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
if ($site === null) {
$site = $this->getSiteWithBase($uri);
}
- $siteFinder->getSiteByPageId(Argument::is(1))->willReturn($site);
+ $siteFinder->method('getSiteByPageId')->willReturn($site);
- return new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, (new HeadlessMode())->withRequest((new ServerRequest())->withAttribute('headless', new Headless())));
+ return new UrlUtility(null, $resolver->reveal(), $siteFinder, null, (new HeadlessMode())->withRequest((new ServerRequest())->withAttribute('headless', new Headless())));
}
}
diff --git a/Tests/Unit/Event/RedirectUrlEventTest.php b/Tests/Unit/Event/RedirectUrlEventTest.php
index ca44a2f1..d89e47a1 100644
--- a/Tests/Unit/Event/RedirectUrlEventTest.php
+++ b/Tests/Unit/Event/RedirectUrlEventTest.php
@@ -12,6 +12,7 @@
namespace FriendsOfTYPO3\Headless\Tests\Unit\Event;
use FriendsOfTYPO3\Headless\Event\RedirectUrlEvent;
+use PHPUnit\Framework\Attributes\Test;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Http\Uri;
@@ -21,9 +22,7 @@ class RedirectUrlEventTest extends UnitTestCase
{
use ProphecyTrait;
- /**
- * @test
- */
+ #[Test]
public function eventTest()
{
$request = (new ServerRequest())->withAttribute('test', 1);
diff --git a/Tests/Unit/Form/Decorator/AbstractFormDefinitionDecoratorTest.php b/Tests/Unit/Form/Decorator/AbstractFormDefinitionDecoratorTest.php
index ff874cbf..68d9ecd1 100644
--- a/Tests/Unit/Form/Decorator/AbstractFormDefinitionDecoratorTest.php
+++ b/Tests/Unit/Form/Decorator/AbstractFormDefinitionDecoratorTest.php
@@ -16,28 +16,24 @@
class AbstractFormDefinitionDecoratorTest extends UnitTestCase
{
- /**
- * @test
- */
- public function basicOutput(): void
+ public function testBasicOutput(): void
{
- $stub = $this->getMockForAbstractClass(AbstractFormDefinitionDecorator::class, [['api' => 'test']]);
+ $class = new class () extends AbstractFormDefinitionDecorator {};
+ $classUnderTest = new $class(['api' => 'test']);
$definition = [
'identifier' => 'test-123',
'renderables' => [0 => ['renderables' => []]],
'i18n' => ['properties' => []],
];
- $test = $stub($definition, 1);
+ $test = $classUnderTest($definition, 1);
self::assertSame(['id' => 'test-123', 'api' => ['api' => 'test'], 'i18n' => [], 'elements' => []], $test);
}
- /**
- * @test
- */
- public function renderElements(): void
+ public function testRenderElements(): void
{
- $stub = $this->getMockForAbstractClass(AbstractFormDefinitionDecorator::class, [['api' => 'test']]);
+ $class = new class () extends AbstractFormDefinitionDecorator {};
+ $classUnderTest = new $class(['api' => 'test']);
$definition = [
'identifier' => 'test-123',
@@ -91,7 +87,7 @@ public function renderElements(): void
],
'i18n' => ['properties' => []],
];
- $test = $stub($definition, 0);
+ $test = $classUnderTest($definition, 0);
self::assertSame([
'id' => 'test-123',
diff --git a/Tests/Unit/Hooks/HeadlessUserIntTest.php b/Tests/Unit/Hooks/HeadlessUserIntTest.php
index 2a7165ca..2b1fa47a 100644
--- a/Tests/Unit/Hooks/HeadlessUserIntTest.php
+++ b/Tests/Unit/Hooks/HeadlessUserIntTest.php
@@ -22,10 +22,7 @@ class HeadlessUserIntTest extends UnitTestCase
{
use ProphecyTrait;
- /**
- * @test
- */
- public function processingOnPlainTextWithNewline()
+ public function testProcessingOnPlainTextWithNewline()
{
$testProcessed = 'PlainText' . PHP_EOL . 'NextLine';
$testContent = 'HEADLESS_INT_START<<' . $testProcessed . '>>HEADLESS_INT_END';
@@ -40,10 +37,7 @@ public function processingOnPlainTextWithNewline()
self::assertEquals(json_encode($testProcessed), '"' . $tsfe->content . '"');
}
- /**
- * @test
- */
- public function processingOnQuotedText()
+ public function testProcessingOnQuotedText()
{
$testProcessed = '"PlainText' . PHP_EOL . 'NextLine"';
$testContent = 'HEADLESS_INT_START<<' . $testProcessed . '>>HEADLESS_INT_END';
@@ -58,10 +52,7 @@ public function processingOnQuotedText()
self::assertEquals(json_encode($testProcessed), '"' . $tsfe->content . '"');
}
- /**
- * @test
- */
- public function processingOnQuotedContent()
+ public function testProcessingOnQuotedContent()
{
$testProcessed = '"PlainText' . PHP_EOL . 'NextLine"';
$testContent = '"HEADLESS_INT_START<<' . $testProcessed . '>>HEADLESS_INT_END"';
@@ -78,10 +69,7 @@ public function processingOnQuotedContent()
self::assertEquals(json_encode($testProcessed), $tsfe->content);
}
- /**
- * @test
- */
- public function processingOnQuotedJsonContent()
+ public function testProcessingOnQuotedJsonContent()
{
$testProcessed = json_encode(
[
@@ -100,10 +88,7 @@ public function processingOnQuotedJsonContent()
self::assertEquals($testProcessed, $tsfe->content);
}
- /**
- * @test
- */
- public function processingEmptyPluginResponse()
+ public function testProcessingEmptyPluginResponse()
{
$testProcessed = json_encode(
''
@@ -134,10 +119,7 @@ public function processingEmptyPluginResponse()
self::assertEquals(json_encode(null), $tsfe->content);
}
- /**
- * @test
- */
- public function processingOnNestedJsonContent()
+ public function testProcessingOnNestedJsonContent()
{
$nestedProcessed = json_encode(
[
@@ -180,10 +162,7 @@ public function processingOnNestedJsonContent()
self::assertEquals($finalOutput, $tsfe->content);
}
- /**
- * @test
- */
- public function processingOnMultipleUserIntOnPageJsonContent()
+ public function testProcessingOnMultipleUserIntOnPageJsonContent()
{
$nestedProcessed = json_encode(
[
@@ -234,10 +213,7 @@ public function processingOnMultipleUserIntOnPageJsonContent()
self::assertEquals($finalOutput, $tsfe->content);
}
- /**
- * @test
- */
- public function wrapTest()
+ public function testWrapTest()
{
$headlessUserInt = new HeadlessUserInt();
diff --git a/Tests/Unit/Json/JsonDecoderTest.php b/Tests/Unit/Json/JsonDecoderTest.php
index 3203bb98..1d297f7b 100644
--- a/Tests/Unit/Json/JsonDecoderTest.php
+++ b/Tests/Unit/Json/JsonDecoderTest.php
@@ -9,9 +9,11 @@
declare(strict_types=1);
-namespace FriendsOfTYPO3\Headless\Tests\Unit\ContentObject;
+namespace FriendsOfTYPO3\Headless\Tests\Unit\Json;
use FriendsOfTYPO3\Headless\Json\JsonDecoder;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Test;
use stdClass;
use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -29,13 +31,7 @@ protected function setUp(): void
parent::setUp();
}
- /**
- * @param $testValue
- * @param $expectedValue
- *
- * @test
- * @dataProvider possibleJsonProvider
- */
+ #[Test, DataProvider('possibleJsonProvider')]
public function possibleFalsePositives($testValue, $expectedValue): void
{
$jsonDecoder = GeneralUtility::makeInstance(JsonDecoder::class);
@@ -43,7 +39,8 @@ public function possibleFalsePositives($testValue, $expectedValue): void
self::assertSame($expectedValue, $jsonDecoder->isJson($testValue));
}
- public function testDecoding(): void
+ #[Test]
+ public function decoding(): void
{
$jsonDecoder = GeneralUtility::makeInstance(JsonDecoder::class);
diff --git a/Tests/Unit/Json/JsonEncoderTest.php b/Tests/Unit/Json/JsonEncoderTest.php
index 3515f917..d9fd1cf3 100644
--- a/Tests/Unit/Json/JsonEncoderTest.php
+++ b/Tests/Unit/Json/JsonEncoderTest.php
@@ -12,6 +12,8 @@
namespace FriendsOfTYPO3\Headless\Tests\Unit\ContentObject;
use FriendsOfTYPO3\Headless\Json\JsonEncoder;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Test;
use stdClass;
use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -27,12 +29,7 @@ protected function setUp(): void
parent::setUp();
}
- /**
- * @param $testValue
- * @param $expectedValue
- *
- * @dataProvider jsonProvider
- */
+ #[Test, DataProvider('jsonProvider')]
public function testEncoding($testValue, $expectedValue): void
{
$encoder = GeneralUtility::makeInstance(JsonEncoder::class);
@@ -40,7 +37,8 @@ public function testEncoding($testValue, $expectedValue): void
self::assertSame($expectedValue, $encoder->encode($testValue));
}
- public function testPrettyEncoding(): void
+ #[Test]
+ public function prettyEncoding(): void
{
$GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['headless.prettyPrint'] = true;
$encoder = GeneralUtility::makeInstance(JsonEncoder::class);
diff --git a/Tests/Unit/Middleware/CookieDomainPerSiteTest.php b/Tests/Unit/Middleware/CookieDomainPerSiteTest.php
index 816e0896..19c73df2 100644
--- a/Tests/Unit/Middleware/CookieDomainPerSiteTest.php
+++ b/Tests/Unit/Middleware/CookieDomainPerSiteTest.php
@@ -13,6 +13,7 @@
use FriendsOfTYPO3\Headless\Middleware\CookieDomainPerSite;
use FriendsOfTYPO3\Headless\Utility\UrlUtility;
+use PHPUnit\Framework\Attributes\Test;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Log\LoggerInterface;
@@ -29,9 +30,7 @@ class CookieDomainPerSiteTest extends UnitTestCase
{
use ProphecyTrait;
- /**
- * @test
- */
+ #[Test]
public function emptyCookieDomain()
{
$site = $this->prophesize(Site::class);
@@ -61,16 +60,16 @@ public function emptyCookieDomain()
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::containingString('Development'))->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getAllSites']);
- $siteFinder->getAllSites()->willReturn([
- $site,
+ $siteFinder->method('getAllSites')->willReturn([
+ $site->reveal(),
]);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal());
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder);
$urlUtility = $urlUtility->withSite($site->reveal());
- $middleware = new CookieDomainPerSite($urlUtility, $siteFinder->reveal(), $this->prophesize(LoggerInterface::class)->reveal());
+ $middleware = new CookieDomainPerSite($urlUtility, $siteFinder, $this->prophesize(LoggerInterface::class)->reveal());
$request = new ServerRequest('https://test-backend-api.tld');
$request = $request->withAttribute('normalizedParams', NormalizedParams::createFromRequest($request));
@@ -88,9 +87,7 @@ public function emptyCookieDomain()
);
}
- /**
- * @test
- */
+ #[Test]
public function cookieDomainIsSet()
{
$site = $this->prophesize(Site::class);
@@ -121,16 +118,16 @@ public function cookieDomainIsSet()
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::containingString('Development'))->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getAllSites']);
- $siteFinder->getAllSites()->willReturn([
- $site,
+ $siteFinder->method('getAllSites')->willReturn([
+ $site->reveal(),
]);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal());
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder);
$urlUtility = $urlUtility->withSite($site->reveal());
- $middleware = new CookieDomainPerSite($urlUtility, $siteFinder->reveal(), $this->prophesize(LoggerInterface::class)->reveal());
+ $middleware = new CookieDomainPerSite($urlUtility, $siteFinder, $this->prophesize(LoggerInterface::class)->reveal());
$request = new ServerRequest('https://test-backend-api.tld');
$request = $request->withAttribute('normalizedParams', NormalizedParams::createFromRequest($request));
diff --git a/Tests/Unit/Middleware/ElementBodyResponseMiddlewareTest.php b/Tests/Unit/Middleware/ElementBodyResponseMiddlewareTest.php
index bd763c8d..2f89de98 100644
--- a/Tests/Unit/Middleware/ElementBodyResponseMiddlewareTest.php
+++ b/Tests/Unit/Middleware/ElementBodyResponseMiddlewareTest.php
@@ -26,10 +26,7 @@ class ElementBodyResponseMiddlewareTest extends UnitTestCase
{
use ProphecyTrait;
- /**
- * @test
- */
- public function processTest()
+ public function testProcess(): void
{
$middleware = new ElementBodyResponseMiddleware(new JsonEncoder(), new HeadlessMode());
diff --git a/Tests/Unit/Middleware/SiteBaseRedirectResolverTest.php b/Tests/Unit/Middleware/SiteBaseRedirectResolverTest.php
index 4353a0f2..0013fae7 100644
--- a/Tests/Unit/Middleware/SiteBaseRedirectResolverTest.php
+++ b/Tests/Unit/Middleware/SiteBaseRedirectResolverTest.php
@@ -60,11 +60,11 @@ public function testJsonRedirect()
],
]]);
- $siteFinder = $this->prophesize(SiteFinder::class);
- $siteFinder->getSiteByPageId(1)->willReturn($site);
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
+ $siteFinder->method('getSiteByPageId')->willReturn($site);
$container = new Container();
- $urlUtility = GeneralUtility::makeInstance(UrlUtility::class, null, $this->prophesize(Resolver::class)->reveal(), $siteFinder->reveal());
+ $urlUtility = GeneralUtility::makeInstance(UrlUtility::class, null, $this->prophesize(Resolver::class)->reveal(), $siteFinder);
$container->set(UrlUtility::class, $urlUtility);
GeneralUtility::setContainer($container);
@@ -131,11 +131,11 @@ public function testJsonRedirect()
],
]]);
- $siteFinder = $this->prophesize(SiteFinder::class);
- $siteFinder->getSiteByPageId(1)->willReturn($site);
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
+ $siteFinder->method('getSiteByPageId')->willReturn($site);
$container = new Container();
- $urlUtility = GeneralUtility::makeInstance(UrlUtility::class, null, $this->prophesize(Resolver::class)->reveal(), $siteFinder->reveal());
+ $urlUtility = GeneralUtility::makeInstance(UrlUtility::class, null, $this->prophesize(Resolver::class)->reveal(), $siteFinder);
$container->set(UrlUtility::class, $urlUtility);
$errorController = $this->prophesize(ErrorController::class);
$errorController->pageNotFoundAction(Argument::any(), Argument::any(), Argument::any())->willReturn(new JsonResponse(['ErrorController' => true]));
diff --git a/Tests/Unit/Middleware/UserIntMiddlewareTest.php b/Tests/Unit/Middleware/UserIntMiddlewareTest.php
index 6ba384d8..5caac21d 100644
--- a/Tests/Unit/Middleware/UserIntMiddlewareTest.php
+++ b/Tests/Unit/Middleware/UserIntMiddlewareTest.php
@@ -16,6 +16,7 @@
use FriendsOfTYPO3\Headless\Utility\Headless;
use FriendsOfTYPO3\Headless\Utility\HeadlessMode;
use FriendsOfTYPO3\Headless\Utility\HeadlessUserInt;
+use PHPUnit\Framework\Attributes\Test;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Http\ServerRequest;
@@ -29,10 +30,8 @@ class UserIntMiddlewareTest extends UnitTestCase
{
use ProphecyTrait;
- /**
- * @test
- */
- public function processTest()
+ #[Test]
+ public function process(): void
{
$middleware = new UserIntMiddleware(new HeadlessUserInt(), new HeadlessMode(), $this->createMock(MetaHandler::class));
diff --git a/Tests/Unit/Utility/UrlUtilityTest.php b/Tests/Unit/Utility/UrlUtilityTest.php
index 8c8d185b..a49dcd76 100644
--- a/Tests/Unit/Utility/UrlUtilityTest.php
+++ b/Tests/Unit/Utility/UrlUtilityTest.php
@@ -70,9 +70,9 @@ public function testFrontendUrls(): void
$resolver->evaluate(Argument::containingString('Development'))->willReturn(true);
$resolver->evaluate(Argument::containingString('Testing'))->willReturn(false);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createMock(SiteFinder::class);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
self::assertSame('https://test-frontend.tld', $urlUtility->getFrontendUrl());
@@ -84,9 +84,9 @@ public function testFrontendUrls(): void
$resolver->evaluate(Argument::containingString('Development'))->willReturn(false);
$resolver->evaluate(Argument::containingString('Testing'))->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createMock(SiteFinder::class);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
self::assertSame('https://test-frontend2.tld', $urlUtility->getFrontendUrl());
@@ -99,11 +99,11 @@ public function testFrontendUrls(): void
$resolver->evaluate(Argument::containingString('Testing'))->willReturn(false);
$resolver->evaluate(Argument::containingString('Misconfigured'))->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createMock(SiteFinder::class);
$site->getBase()->shouldBeCalled(2)->willReturn(new Uri('https://test-backend3-api.tld/'));
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
self::assertSame('https://test-frontend3.tld', $urlUtility->getFrontendUrl());
@@ -135,9 +135,9 @@ public function testFrontendUrlsWithDifferentPaths(): void
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::containingString('Development'))->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createMock(SiteFinder::class);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
self::assertSame('https://test-frontend.tld/frontend/content-page', $urlUtility->getFrontendUrlWithSite('https://test-backend-api.tld/dev-path/content-page', $site->reveal()));
@@ -165,7 +165,7 @@ public function testFrontendUrlsWithBaseProductionAndLocalOverride(): void
],
]);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createMock(SiteFinder::class);
// local override
$resolver = $this->prophesize(Resolver::class);
@@ -173,7 +173,7 @@ public function testFrontendUrlsWithBaseProductionAndLocalOverride(): void
$headlessMode = $this->createHeadlessMode();
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
self::assertSame('https://test-frontend.tld', $urlUtility->getFrontendUrl());
@@ -185,7 +185,7 @@ public function testFrontendUrlsWithBaseProductionAndLocalOverride(): void
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::containingString('Development'))->willReturn(false);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
self::assertSame('https://www.typo3.org', $urlUtility->getFrontendUrl());
@@ -224,9 +224,9 @@ public function testOptimizedUrlsForFrontendApp(): void
$resolver->evaluate(Argument::containingString('Development'))->willReturn(true);
$resolver->evaluate(Argument::containingString('Testing'))->willReturn(false);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createMock(SiteFinder::class);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
// same page, so we make it relative
@@ -253,9 +253,9 @@ public function testOptimizedUrlsForFrontendApp(): void
$resolver->evaluate(Argument::containingString('Development'))->willReturn(false);
$resolver->evaluate(Argument::containingString('Testing'))->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createMock(SiteFinder::class);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
// same page, so we make it relative
@@ -320,9 +320,9 @@ public function testLanguageResolver(): void
$resolver->evaluate(Argument::containingString('Development'))->willReturn(true);
$resolver->evaluate(Argument::containingString('Testing'))->willReturn(false);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createMock(SiteFinder::class);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
$urlUtility = $urlUtility->withLanguage(new SiteLanguage(0, 'en', new Uri('/'), [
'title' => 'English',
@@ -371,7 +371,7 @@ public function testLanguageResolver(): void
self::assertSame('https://test-frontend-from-lang.tld/headless/fileadmin', $urlUtility->getStorageProxyUrl());
// not overlay site variants if language has not defined variants
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal());
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder);
$urlUtility = $urlUtility->withSite($site->reveal());
$urlUtility = $urlUtility->withLanguage(new SiteLanguage(0, 'en', new Uri('/'), [
'title' => 'English',
@@ -394,9 +394,9 @@ public function testLanguageResolver(): void
$resolver->evaluate(Argument::containingString('Development'))->willReturn(false);
$resolver->evaluate(Argument::containingString('Testing'))->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
+ $siteFinder = $this->createMock(SiteFinder::class);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
$urlUtility = $urlUtility->withLanguage(new SiteLanguage(0, 'en', new Uri('/'), [
'title' => 'English',
@@ -453,11 +453,11 @@ public function testFrontendUrlForPage(): void
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
- $siteFinder->getSiteByPageId(Argument::is(1))->shouldBeCalled(2)->willReturn($site->reveal());
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
+ $siteFinder->method('getSiteByPageId')->willReturn($site->reveal());
$headlessMode = $this->createHeadlessMode(HeadlessMode::NONE);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
// flag is not existing/disabled
@@ -468,7 +468,7 @@ public function testFrontendUrlForPage(): void
$headlessMode = $this->createHeadlessMode(HeadlessMode::FULL);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
self::assertSame(
'https://test-frontend.tld/test-page',
@@ -499,12 +499,12 @@ public function testFrontendUrlForPageWithAlreadyFrontendUrlResolved(): void
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
- $siteFinder->getSiteByPageId(Argument::is(1))->shouldBeCalledOnce()->willReturn($site->reveal());
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
+ $siteFinder->method('getSiteByPageId')->willReturn($site->reveal());
$headlessMode = $this->createHeadlessMode();
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
self::assertSame(
@@ -535,11 +535,11 @@ public function testFrontendUrlForPageWithPortsOnFrontendSide(): void
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
- $siteFinder->getSiteByPageId(Argument::is(1))->shouldBeCalled(2)->willReturn($site->reveal());
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
+ $siteFinder->method('getSiteByPageId')->willReturn($site->reveal());
$headlessMode = $this->createHeadlessMode(HeadlessMode::NONE);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
// flag is not existing/disabled
@@ -550,7 +550,7 @@ public function testFrontendUrlForPageWithPortsOnFrontendSide(): void
// flag is enabled
$headlessMode = $this->createHeadlessMode();
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
self::assertSame(
'https://test-frontend.tld:3000/test-page',
@@ -581,10 +581,10 @@ public function testFrontendUrlForPageWithPortsOnBothSides(): void
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
- $siteFinder->getSiteByPageId(Argument::is(1))->shouldBeCalled(2)->willReturn($site->reveal());
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
+ $siteFinder->method('getSiteByPageId')->willReturn($site->reveal());
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
// flag is not existing/disabled
@@ -595,7 +595,7 @@ public function testFrontendUrlForPageWithPortsOnBothSides(): void
// flag is enabled
$headlessMode = $this->createHeadlessMode();
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), null, $headlessMode);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, null, $headlessMode);
$urlUtility = $urlUtility->withSite($site->reveal());
self::assertSame(
'https://test-frontend.tld:3000/test-page',
@@ -617,9 +617,9 @@ public function testEdgeCases()
$resolver = $this->prophesize(Resolver::class);
$resolver->evaluate(Argument::any())->willReturn(true);
- $siteFinder = $this->prophesize(SiteFinder::class);
- $siteFinder->getSiteByPageId(Argument::is(1))->shouldBeCalledOnce()->willReturn($site);
- $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder->reveal(), $request->reveal(), null, $headlessMode);
+ $siteFinder = $this->createPartialMock(SiteFinder::class, ['getSiteByPageId']);
+ $siteFinder->method('getSiteByPageId')->willReturn($site);
+ $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, $request->reveal(), null, $headlessMode);
self::assertSame(
'https://test-backend-api.tld:8000/test-page',
diff --git a/Tests/Unit/XClass/TemplateViewTest.php b/Tests/Unit/XClass/TemplateViewTest.php
index a3197b49..e8a94c76 100644
--- a/Tests/Unit/XClass/TemplateViewTest.php
+++ b/Tests/Unit/XClass/TemplateViewTest.php
@@ -14,6 +14,7 @@
use FriendsOfTYPO3\Headless\Utility\Headless;
use FriendsOfTYPO3\Headless\Utility\HeadlessMode;
use FriendsOfTYPO3\Headless\XClass\TemplateView;
+use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use RuntimeException;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext;
@@ -27,6 +28,7 @@
use function json_encode;
+#[IgnoreDeprecations]
class TemplateViewTest extends UnitTestCase
{
public function testTemplateNotFoundRender(): void
diff --git a/Tests/Unit/phpunit.xml b/Tests/Unit/phpunit.xml
index 71bf1ca2..b66cdc5c 100644
--- a/Tests/Unit/phpunit.xml
+++ b/Tests/Unit/phpunit.xml
@@ -1,27 +1,19 @@
-
-
- ../../Classes
-
-
./
@@ -29,7 +21,12 @@
-
-
+
+
+
diff --git a/composer.json b/composer.json
index 52e8ce0e..74c503c7 100644
--- a/composer.json
+++ b/composer.json
@@ -28,8 +28,8 @@
],
"require": {
"ext-json": "*",
- "typo3/cms-core": "^12.4 || ^13.3",
- "typo3/cms-install": "^12.4 || ^13.3"
+ "typo3/cms-core": "^12.4 || ^13.4",
+ "typo3/cms-install": "^12.4 || ^13.4"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.43",