-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TASK: Check if container extension is installed (#11)
Related: #7 Co-authored-by: Daniel Gohlke <[email protected]>
- Loading branch information
1 parent
7dbf519
commit 445ccfd
Showing
18 changed files
with
183 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...poScript/ContentElements/image.typoscript → ...poScript/ContentElements/image.typoscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
Tests/Fixtures/base_example/Configuration/TypoScript/Setup.typoscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<INCLUDE_TYPOSCRIPT: source="DIR:EXT:base_example/Configuration/TypoScript/ContentElements/"> | ||
<INCLUDE_TYPOSCRIPT: source="DIR:EXT:base_example/Configuration/TypoScript/Extensions/"> |
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
Tests/Fixtures/base_example/Test/Fixtures/0colDatabase.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
return [ | ||
'tt_content' => [ | ||
1 => [ | ||
'uid' => '1', | ||
'pid' => '2', | ||
'hidden' => '0', | ||
'sorting' => '1', | ||
'CType' => 'image', | ||
'header' => 'image', | ||
'deleted' => '0', | ||
'starttime' => '0', | ||
'endtime' => '0', | ||
'colPos' => '0', | ||
'sys_language_uid' => '0', | ||
'image' => '1', | ||
], | ||
], | ||
'sys_file_reference' => [ | ||
0 => [ | ||
'uid' => '1', | ||
'pid' => '2', | ||
'uid_local' => '1', | ||
'uid_foreign' => '1', | ||
'tablenames' => 'tt_content', | ||
'fieldname' => 'image', | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "codappix/base_example", | ||
"description": "Add a base example for frontend tests", | ||
"type": "typo3-cms-extension", | ||
"license": "GPL-2.0-or-later", | ||
"require": { | ||
"typo3/cms-core": "*", | ||
"codappix/responsive-images": "*" | ||
}, | ||
"extra": { | ||
"typo3/cms": { | ||
"extension-key": "base_example" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Codappix\ResponsiveImages\Tests; | ||
|
||
/* | ||
* Copyright (C) 2024 Daniel Gohlke <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
* 02110-1301, USA. | ||
*/ | ||
|
||
use Codappix\Typo3PhpDatasets\TestingFramework; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use PHPUnit\Framework\Attributes\Test; | ||
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; | ||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; | ||
|
||
class BaseTest extends FunctionalTestCase | ||
{ | ||
use TestingFramework; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->coreExtensionsToLoad = [ | ||
'fluid_styled_content', | ||
]; | ||
|
||
$this->testExtensionsToLoad = [ | ||
'codappix/responsive-images', | ||
'typo3conf/ext/responsive_images/Tests/Fixtures/base_example', | ||
]; | ||
|
||
$this->pathsToLinkInTestInstance = [ | ||
'typo3conf/ext/responsive_images/Tests/Fixtures/fileadmin/test_data' => 'fileadmin/test_data', | ||
'typo3conf/ext/responsive_images/Tests/Fixtures/config/sites' => 'typo3conf/sites', | ||
]; | ||
|
||
parent::setUp(); | ||
|
||
$this->importPHPDataSet(__DIR__ . '/../Fixtures/BaseDatabase.php'); | ||
$this->setUpFrontendRootPage(1, [ | ||
'EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript', | ||
'EXT:responsive_images/Configuration/TypoScript/Setup.typoscript', | ||
'EXT:base_example/Configuration/TypoScript/Setup.typoscript', | ||
'EXT:base_example/Configuration/TypoScript/Rendering.typoscript', | ||
]); | ||
} | ||
|
||
public static function imageScalingValuesDataProvider(): iterable | ||
{ | ||
yield '0 Column' => [ | ||
'0colDatabase.php', | ||
[ | ||
'0' => 'mobile 734 (max-width: 480px)', | ||
'1' => 'mobile 704 (max-width: 767px)', | ||
'2' => 'tablet 924 (max-width: 991px)', | ||
'3' => 'default 1124 (max-width: 1479px)', | ||
'4' => 'large 1124 (min-width: 1480px)', | ||
], | ||
]; | ||
} | ||
|
||
#[Test] | ||
#[DataProvider(methodName: 'imageScalingValuesDataProvider')] | ||
public function imageIsScaledCorrectly(string $phpDataSet, array $expectedValues): void | ||
{ | ||
$this->importPHPDataSet(__DIR__ . '/../Fixtures/base_example/Test/Fixtures/' . $phpDataSet); | ||
|
||
$request = new InternalRequest(); | ||
$request = $request->withPageId(2); | ||
|
||
$result = $this->executeFrontendSubRequest($request); | ||
|
||
self::assertSame(200, $result->getStatusCode()); | ||
|
||
foreach ($expectedValues as $expectedValue) { | ||
self::assertStringContainsString($expectedValue, (string) $result->getBody()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters