first commit
This commit is contained in:
commit
1218dd1517
12716 files changed
+989233
No files matched your search
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the package bk2k/bootstrap-package.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace BK2K\BootstrapPackage\Tests\Functional\Parser;
|
||||
|
||||
use BK2K\BootstrapPackage\Service\CompileService;
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
use TYPO3\CMS\Core\Core\Environment;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||
|
||||
/**
|
||||
* Testcase for class \BK2K\BootstrapPackage\Parser\ScssParser
|
||||
*/
|
||||
class ScssParserTest extends FunctionalTestCase
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $testExtensionsToLoad = [
|
||||
'typo3conf/ext/bootstrap_package',
|
||||
'typo3conf/ext/demo_package',
|
||||
];
|
||||
|
||||
/**
|
||||
* Asserts that a file contains a needle.
|
||||
*/
|
||||
protected static function assertFileContains(string $filename, string $needle): void
|
||||
{
|
||||
self::assertFileIsReadable($filename);
|
||||
$content = file_get_contents($filename);
|
||||
|
||||
try {
|
||||
self::assertStringContainsString($needle, $content);
|
||||
} catch (ExpectationFailedException $e) {
|
||||
self::fail(\sprintf(
|
||||
'Failed asserting that file \'%s\' contains \'%s\'',
|
||||
$filename,
|
||||
$needle
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider scssParserCanCompileTestDataProvider
|
||||
*/
|
||||
public function scssParserCanCompileTest($inputFile)
|
||||
{
|
||||
$compileService = GeneralUtility::makeInstance(CompileService::class);
|
||||
$compiledFile = $compileService->getCompiledFile($inputFile);
|
||||
$this->assertFileExists(Environment::getPublicPath() . '/' . $compiledFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function scssParserCanCompileTestDataProvider()
|
||||
{
|
||||
return [
|
||||
'direct include' => [
|
||||
'inputFile' => 'typo3conf/ext/bootstrap_package/Resources/Public/Scss/Theme/theme.scss'
|
||||
],
|
||||
'relative include from symlinked package' => [
|
||||
'inputFile' => 'typo3conf/ext/demo_package/Resources/Private/Scss/Relative/theme.scss'
|
||||
],
|
||||
'core syntax' => [
|
||||
'inputFile' => 'typo3conf/ext/demo_package/Resources/Private/Scss/CoreSyntax/theme.scss'
|
||||
],
|
||||
'legacy include' => [
|
||||
'inputFile' => 'typo3conf/ext/demo_package/Resources/Private/Scss/Legacy/theme.scss'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function urlsAreRelativeToTempTest()
|
||||
{
|
||||
$compileService = GeneralUtility::makeInstance(CompileService::class);
|
||||
$compiledFile = Environment::getPublicPath() . '/' . $compileService->getCompiledFile(
|
||||
'typo3conf/ext/bootstrap_package/Resources/Public/Scss/Theme/theme.scss'
|
||||
);
|
||||
$this->assertFileContains(
|
||||
$compiledFile,
|
||||
'url("../../../../typo3conf/ext/bootstrap_package/Resources/Public/Images/PhotoSwipe/default-skin.png")'
|
||||
);
|
||||
$this->assertFileContains(
|
||||
$compiledFile,
|
||||
'url("../../../../typo3conf/ext/bootstrap_package/Resources/Public/Images/PhotoSwipe/default-skin.svg")'
|
||||
);
|
||||
$this->assertFileContains(
|
||||
$compiledFile,
|
||||
'url("../../../../typo3conf/ext/bootstrap_package/Resources/Public/Images/PhotoSwipe/preloader.gif")'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function sitepackageImagesAreUsedTest()
|
||||
{
|
||||
$compileService = GeneralUtility::makeInstance(CompileService::class);
|
||||
$compiledFile = Environment::getPublicPath() . '/' . $compileService->getCompiledFile(
|
||||
'typo3conf/ext/demo_package/Resources/Private/Scss/Relative/theme.scss'
|
||||
);
|
||||
$this->assertFileContains(
|
||||
$compiledFile,
|
||||
'url("../../../../typo3conf/ext/demo_package/Resources/Public/Images/PhotoSwipe/default-skin.png")'
|
||||
);
|
||||
$this->assertFileContains(
|
||||
$compiledFile,
|
||||
'url("../../../../typo3conf/ext/demo_package/Resources/Public/Images/PhotoSwipe/default-skin.svg")'
|
||||
);
|
||||
$this->assertFileContains(
|
||||
$compiledFile,
|
||||
'url("../../../../typo3conf/ext/demo_package/Resources/Public/Images/PhotoSwipe/preloader.gif")'
|
||||
);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the package bk2k/bootstrap-package.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
defined('TYPO3_MODE') || die();
|
||||
|
||||
/**
|
||||
* Default TypoScript for DemoPackage
|
||||
*/
|
||||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
|
||||
'demo_package',
|
||||
'Configuration/TypoScript',
|
||||
'Demo Package'
|
||||
);
|
||||
+1
@@ -0,0 +1 @@
|
||||
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TypoScript/constants.typoscript">
|
||||
+1
@@ -0,0 +1 @@
|
||||
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TypoScript/setup.typoscript">
|
||||
+1
@@ -0,0 +1 @@
|
||||
@import "EXT:bootstrap_package/Resources/Public/Scss/Theme/theme";
|
||||
+1
@@ -0,0 +1 @@
|
||||
@import "../../../../../../../.build/web/typo3conf/ext/bootstrap_package/Resources/Public/Scss/Theme/theme";
|
||||
+1
@@ -0,0 +1 @@
|
||||
@import "../../../../../bootstrap_package/Resources/Public/Scss/Theme/theme";
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 547 B |
+1
@@ -0,0 +1 @@
|
||||
<svg width="264" height="88" viewBox="0 0 264 88" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="M67.002 59.5v3.768c-6.307.84-9.184 5.75-10.002 9.732 2.22-2.83 5.564-5.098 10.002-5.098V71.5L73 65.585 67.002 59.5zM13 29v-5h2v3h3v2h-5zm0-14h5v2h-3v3h-2v-5zm18 0v5h-2v-3h-3v-2h5zm0 14h-5v-2h3v-3h2v5zm31-5v5h-2v-3h-3v-2h5zm0-4h-5v-2h3v-3h2v5zm8 0v-5h2v3h3v2h-5zm0 4h5v2h-3v3h-2v-5zM20.586 66l-5.656-5.656 1.414-1.414L22 64.586l5.656-5.656 1.414 1.414L23.414 66l5.656 5.656-1.414 1.414L22 67.414l-5.656 5.656-1.414-1.414L20.586 66zm91.199-.97L110 63.5l3-3.5h-10v-2h10l-3-3.5 1.785-1.468L117 59l-5.215 6.03zm40.43 0L154 63.5l-3-3.5h10v-2h-10l3-3.5-1.785-1.468L147 59l5.215 6.03zm8.742-36.487l-3.25-3.25-1.413 1.414 3.25 3.25z" fill="#fff"/><path d="M152.5 27a5.5 5.5 0 100-11 5.5 5.5 0 100 11z" stroke="#fff" stroke-width="1.5"/><path fill="#fff" d="M150 21h5v1h-5zm-33.043 7.543l-1.414 1.414-3.25-3.25 1.414-1.414 3.25 3.25z"/><path d="M108.5 27a5.5 5.5 0 100-11 5.5 5.5 0 100 11z" stroke="#fff" stroke-width="1.5"/><path fill="#fff" d="M106 21h5v1h-5z"/><path fill="#fff" d="M109.043 19.008l-.085 5-1-.017.085-5z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 866 B |
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "bk2k/demo-package",
|
||||
"type": "typo3-cms-extension",
|
||||
"description": "Bootstrap Package Extension / Overwrite Tests",
|
||||
"homepage": "https://www.bootstrap-package.com",
|
||||
"license": ["GPL-2.0-or-later"],
|
||||
"keywords": ["TYPO3 CMS"],
|
||||
"require": {
|
||||
"bk2k/bootstrap-package": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Bk2k\\DemoPackage\\": "Classes/"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the package bk2k/bootstrap-package.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
$EM_CONF[$_EXTKEY] = [
|
||||
'title' => 'Demo Package',
|
||||
'description' => '',
|
||||
'category' => 'templates',
|
||||
'constraints' => [
|
||||
'depends' => [
|
||||
'bootstrap_package' => '*',
|
||||
],
|
||||
],
|
||||
'autoload' => [
|
||||
'psr-4' => [
|
||||
'BK2K\\DemoPackage\\' => 'Classes',
|
||||
],
|
||||
],
|
||||
'state' => 'stable',
|
||||
'uploadfolder' => 0,
|
||||
'createDirs' => '',
|
||||
'clearCacheOnLoad' => 1,
|
||||
'author' => 'Benjamin Kott',
|
||||
'author_email' => 'info@bk2k.info',
|
||||
'author_company' => 'BK2K',
|
||||
'version' => '1.0.0',
|
||||
];
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the package bk2k/bootstrap-package.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
defined('TYPO3_MODE') || die();
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the package bk2k/bootstrap-package.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
defined('TYPO3_MODE') || die();
|
||||
@@ -0,0 +1,20 @@
|
||||
// Variables
|
||||
$radius: 1rem;
|
||||
$preCalculatedRadius: $radius / 2;
|
||||
|
||||
// Tests
|
||||
.case-without-variable {
|
||||
border-radius: 1rem / 2;
|
||||
}
|
||||
.case-with-variable {
|
||||
border-radius: $radius / 2;
|
||||
}
|
||||
.case-precalculated-variable {
|
||||
border-radius: $preCalculatedRadius / 2;
|
||||
}
|
||||
|
||||
$width: 1rem;
|
||||
button {
|
||||
width: $width / 2;
|
||||
border-radius: $width / 2;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
.case-without-variable {
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
.case-with-variable {
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
.case-precalculated-variable {
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
button {
|
||||
width: 0.5rem;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the package bk2k/bootstrap-package.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace BK2K\BootstrapPackage\Tests\Unit\Compiler;
|
||||
|
||||
use ScssPhp\ScssPhp\Compiler;
|
||||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
|
||||
|
||||
/**
|
||||
* Testcase for class \ScssPhp\ScssPhp\Compiler
|
||||
*/
|
||||
class ScssCompilerTest extends UnitTestCase
|
||||
{
|
||||
/**
|
||||
* @param string $file
|
||||
* @param string $expectedResultFile
|
||||
* @dataProvider compileDataProvider
|
||||
* @test
|
||||
*/
|
||||
public function compile(string $file, string $expectedResultFile)
|
||||
{
|
||||
$scss = new Compiler();
|
||||
$resultCss = $scss->compile(file_get_contents(__DIR__ . '/' . $file), $file);
|
||||
$expectedCss = file_get_contents(__DIR__ . '/' . $expectedResultFile);
|
||||
$this->assertSame($expectedCss, $resultCss);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function compileDataProvider()
|
||||
{
|
||||
return [
|
||||
'Calculation' => [
|
||||
'Fixtures/Calculation/Input.scss',
|
||||
'Fixtures/Calculation/Output.css'
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the package bk2k/bootstrap-package.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace BK2K\BootstrapPackage\Tests\Unit\Utility;
|
||||
|
||||
use BK2K\BootstrapPackage\Utility\ExternalMediaUtility;
|
||||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
|
||||
|
||||
/**
|
||||
* Testcase for class \BK2K\BootstrapPackage\Utility\ExternalMediaUtility
|
||||
*/
|
||||
class ExternalMediaUtilityTest extends UnitTestCase
|
||||
{
|
||||
/**
|
||||
* @param string $url
|
||||
* @param string $class
|
||||
* @param string $expectedResult
|
||||
* @dataProvider getEmbedCodeDataProvider
|
||||
* @test
|
||||
*/
|
||||
public function getEmbedCode(string $url, string $class, $expectedResult)
|
||||
{
|
||||
$this->assertSame($expectedResult, (new ExternalMediaUtility())->getEmbedCode($url, $class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getEmbedCodeDataProvider()
|
||||
{
|
||||
return [
|
||||
'empty' => ['', '', null],
|
||||
'www.youtube.com' => ['https://www.youtube.com/watch?v=zpOVYePk6mM', '', '<iframe src="https://www.youtube-nocookie.com/embed/zpOVYePk6mM" frameborder="0" allowfullscreen></iframe>'],
|
||||
'youtube.com' => ['https://youtube.com/watch?v=zpOVYePk6mM', '', '<iframe src="https://www.youtube-nocookie.com/embed/zpOVYePk6mM" frameborder="0" allowfullscreen></iframe>'],
|
||||
'www.youtu.be' => ['https://www.youtu.be/zpOVYePk6mM', '', '<iframe src="https://www.youtube-nocookie.com/embed/zpOVYePk6mM" frameborder="0" allowfullscreen></iframe>'],
|
||||
'youtu.de' => ['https://youtu.be/zpOVYePk6mM', '', '<iframe src="https://www.youtube-nocookie.com/embed/zpOVYePk6mM" frameborder="0" allowfullscreen></iframe>'],
|
||||
'vimeo' => ['https://vimeo.com/143018597', '', '<iframe src="https://player.vimeo.com/video/143018597" frameborder="0" allowfullscreen></iframe>'],
|
||||
'www.youtube.com with class' => ['https://www.youtube.com/watch?v=zpOVYePk6mM', 'test', '<iframe class="test" src="https://www.youtube-nocookie.com/embed/zpOVYePk6mM" frameborder="0" allowfullscreen></iframe>'],
|
||||
'youtube.com with class' => ['https://youtube.com/watch?v=zpOVYePk6mM', 'test', '<iframe class="test" src="https://www.youtube-nocookie.com/embed/zpOVYePk6mM" frameborder="0" allowfullscreen></iframe>'],
|
||||
'www.youtu.be with class' => ['https://www.youtu.be/zpOVYePk6mM', 'test', '<iframe class="test" src="https://www.youtube-nocookie.com/embed/zpOVYePk6mM" frameborder="0" allowfullscreen></iframe>'],
|
||||
'youtu.de with class' => ['https://youtu.be/zpOVYePk6mM', 'test', '<iframe class="test" src="https://www.youtube-nocookie.com/embed/zpOVYePk6mM" frameborder="0" allowfullscreen></iframe>'],
|
||||
'vimeo with class' => ['https://vimeo.com/143018597', 'test', '<iframe class="test" src="https://player.vimeo.com/video/143018597" frameborder="0" allowfullscreen></iframe>'],
|
||||
];
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user