-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #6 Adding functional test for AssetMapper integration (weaverryan)
This PR was squashed before being merged into the main branch. Discussion ---------- Adding functional test for AssetMapper integration Closes #5 Commits ------- 7c0b614 Adding functional test for AssetMapper integration
- Loading branch information
Showing
8 changed files
with
137 additions
and
8 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
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,47 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the SymfonyCasts TailwindBundle package. | ||
* Copyright (c) SymfonyCasts <https://symfonycasts.com/> | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfonycasts\TailwindBundle\Tests; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
use Symfony\Component\AssetMapper\AssetMapperInterface; | ||
use Symfony\Component\AssetMapper\MappedAsset; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
|
||
class FunctionalTest extends KernelTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
$fs = new Filesystem(); | ||
$tailwindVarDir = __DIR__.'/fixtures/var/tailwind'; | ||
if (is_dir($tailwindVarDir)) { | ||
$fs->remove($tailwindVarDir); | ||
} | ||
$fs->mkdir($tailwindVarDir); | ||
file_put_contents($tailwindVarDir.'/tailwind.built.css', 'the built css'); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
if (is_file(__DIR__.'/fixtures/var/tailwind/tailwind.built.css')) { | ||
unlink(__DIR__.'/fixtures/var/tailwind/tailwind.built.css'); | ||
} | ||
} | ||
|
||
public function testBuiltCSSFileIsUsed(): void | ||
{ | ||
self::bootKernel(); | ||
$assetMapper = self::getContainer()->get('asset_mapper'); | ||
\assert($assetMapper instanceof AssetMapperInterface); | ||
|
||
$asset = $assetMapper->getAsset('styles/app.css'); | ||
$this->assertInstanceOf(MappedAsset::class, $asset); | ||
$this->assertSame('the built css', $asset->content); | ||
} | ||
} |
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,68 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the SymfonyCasts TailwindBundle package. | ||
* Copyright (c) SymfonyCasts <https://symfonycasts.com/> | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfonycasts\TailwindBundle\Tests\fixtures; | ||
|
||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; | ||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
use Symfonycasts\TailwindBundle\SymfonycastsTailwindBundle; | ||
|
||
class TailwindTestKernel extends Kernel | ||
{ | ||
use MicroKernelTrait; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct('test', true); | ||
} | ||
|
||
public function registerBundles(): array | ||
{ | ||
return [ | ||
new FrameworkBundle(), | ||
new SymfonycastsTailwindBundle(), | ||
]; | ||
} | ||
|
||
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void | ||
{ | ||
$container->loadFromExtension('framework', [ | ||
'secret' => 'foo', | ||
'test' => true, | ||
'http_method_override' => true, | ||
'asset_mapper' => [ | ||
'paths' => [ | ||
__DIR__.'/assets', | ||
], | ||
], | ||
]); | ||
|
||
$container->loadFromExtension('symfonycasts_tailwind', [ | ||
'input_css' => __DIR__.'/assets/styles/app.css', | ||
]); | ||
} | ||
|
||
public function getCacheDir(): string | ||
{ | ||
return sys_get_temp_dir().'/cache'.spl_object_hash($this); | ||
} | ||
|
||
public function getLogDir(): string | ||
{ | ||
return sys_get_temp_dir().'/logs'.spl_object_hash($this); | ||
} | ||
|
||
public function getProjectDir(): string | ||
{ | ||
return __DIR__; | ||
} | ||
} |
File renamed without changes.
Empty file.