Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,20 @@ env:
- COMPOSER_FLAGS="--prefer-stable"

php:
- '7.1'
- '7.2'
- '7.3'
- 7.3
- 7.4
- nightly

matrix:
include:
- php: 7.1
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 7.1
env: COMPOSER_FLAGS=""
- php: 7.2
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 7.2
env: COMPOSER_FLAGS=""
- php: 7.3
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 7.3
env: COMPOSER_FLAGS=""
- php: 7.4
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 7.4
env: COMPOSER_FLAGS=""
allow_failures:
- php: nightly

Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"abandoned": true,
"require": {
"php": "^7.1.0",
"php": "^7.3",
"ext-json": "*",
"monolog/monolog": "~1.25",
"symfony/monolog-bundle": "^4.0.0||^3.1.0",
Expand All @@ -14,8 +14,9 @@
},
"require-dev": {
"hostnet/phpcs-tool": "^8.3",
"phpunit/phpunit": "^7.5.9",
"symfony/phpunit-bridge": "^3.3.2"
"phpunit/phpunit": "^9.4",
"symfony/phpunit-bridge": "^3.3.2",
"phpspec/prophecy-phpunit": "^2.0"
},
"conflict": {
"phpdocumentor/type-resolver": "<0.2.1"
Expand Down
35 changes: 15 additions & 20 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation = "http://schema.phpunit.de/7.2/phpunit.xsd"
bootstrap = "vendor/autoload.php"
colors = "true"
>
<php>
<server name="KERNEL_DIR" value="test/Fixture"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak_vendors"/>
</php>
<testsuites>
<testsuite name="WebpackBundle - Test Suite">
<directory>./test</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>
<php>
<server name="KERNEL_DIR" value="test/Fixture"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak_vendors"/>
</php>
<testsuites>
<testsuite name="WebpackBundle - Test Suite">
<directory>./test</directory>
</testsuite>
</testsuites>
</phpunit>
3 changes: 2 additions & 1 deletion src/Bundle/Command/CompileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ public function __construct(CacheGuard $guard)
*
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->guard->rebuild();
return 0;
}
}
21 changes: 2 additions & 19 deletions src/Bundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\HttpKernel\Kernel;

class Configuration implements ConfigurationInterface
{
Expand Down Expand Up @@ -174,27 +173,11 @@ private function applyConfigurationFromClass($interface, NodeBuilder $node_build

private function createTreeBuilder(): TreeBuilder
{
if (Kernel::VERSION_ID >= 40200) {
return new TreeBuilder(self::CONFIG_ROOT);
}

if (Kernel::VERSION_ID >= 30300 && Kernel::VERSION_ID < 40200) {
return new TreeBuilder();
}

throw new \RuntimeException('This bundle can only be used by Symfony 3.3 and up.');
return new TreeBuilder(self::CONFIG_ROOT);
}

private function retrieveRootNode(TreeBuilder $tree_builder): NodeDefinition
{
if (Kernel::VERSION_ID >= 40200) {
return $tree_builder->getRootNode();
}

if (Kernel::VERSION_ID >= 30300 && Kernel::VERSION_ID < 40200) {
return $tree_builder->root(self::CONFIG_ROOT);
}

throw new \RuntimeException('This bundle can only be used by Symfony 3.3 and up.');
return $tree_builder->getRootNode();
}
}
1 change: 0 additions & 1 deletion src/Component/Asset/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public function compile(): string
);
$this->profiler->set('compiler.performance.prepare', $this->stopwatch->stop('webpack.prepare')->getDuration());
$this->stopwatch->start('webpack.compiler');
$this->process->inheritEnvironmentVariables(true);
$this->process->run();

$output = $this->process->getOutput() . $this->process->getErrorOutput();
Expand Down
21 changes: 2 additions & 19 deletions test/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,16 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\HttpKernel\Kernel;

class AbstractTestCase extends TestCase
{
protected function createTreeBuilder(string $config_root): TreeBuilder
{
if (Kernel::VERSION_ID >= 40200) {
return new TreeBuilder($config_root);
}

if (Kernel::VERSION_ID >= 30300 && Kernel::VERSION_ID < 40200) {
return new TreeBuilder();
}

throw new \RuntimeException('This bundle can only be used by Symfony 3.3 and up.');
return new TreeBuilder($config_root);
}

protected function retrieveRootNode(TreeBuilder $tree_builder, string $config_root): NodeDefinition
{
if (Kernel::VERSION_ID >= 40200) {
return $tree_builder->getRootNode();
}

if (Kernel::VERSION_ID >= 30300 && Kernel::VERSION_ID < 40200) {
return $tree_builder->root($config_root);
}

throw new \RuntimeException('This bundle can only be used by Symfony 3.3 and up.');
return $tree_builder->getRootNode();
}
}
3 changes: 3 additions & 0 deletions test/Bundle/CacheWarmer/WebpackCompileCacheWarmerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@

use Hostnet\Component\Webpack\Asset\CacheGuard;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

/**
* @covers \Hostnet\Bundle\WebpackBundle\CacheWarmer\WebpackCompileCacheWarmer
*/
class WebpackCompileCacheWarmerTest extends TestCase
{
use ProphecyTrait;

/**
* Simple test to see the guard is executed from the cache warmer.
*/
Expand Down
3 changes: 3 additions & 0 deletions test/Bundle/Command/CompileCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use Hostnet\Component\Webpack\Asset\CacheGuard;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\NullOutput;

Expand All @@ -16,6 +17,8 @@
*/
class CompileCommandTest extends TestCase
{
use ProphecyTrait;

/**
* Simple test to see the validate function is executed from the CacheGard class.
*/
Expand Down
3 changes: 3 additions & 0 deletions test/Bundle/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
use Hostnet\Component\Webpack\Configuration\Loader\CssLoader;
use Hostnet\Component\Webpack\Configuration\Plugin\DefinePlugin;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

/**
* @covers \Hostnet\Bundle\WebpackBundle\DependencyInjection\Configuration
*/
class ConfigurationTest extends TestCase
{
use ProphecyTrait;

public function testGetConfigTreeBuilder(): void
{
$config = new Configuration([], [DefinePlugin::class, CssLoader::class]);
Expand Down
3 changes: 3 additions & 0 deletions test/Bundle/DependencyInjection/WebpackCompilerPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Hostnet\Fixture\WebpackBundle\Bundle\BarBundle\BarBundle;
use Hostnet\Fixture\WebpackBundle\Bundle\FooBundle\FooBundle;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
Expand All @@ -29,6 +30,8 @@
*/
class WebpackCompilerPassTest extends TestCase
{
use ProphecyTrait;

public function testPass(): void
{
$bundle = new WebpackBundle();
Expand Down
3 changes: 3 additions & 0 deletions test/Bundle/DependencyInjection/WebpackExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
namespace Hostnet\Bundle\WebpackBundle\DependencyInjection;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
* @covers \Hostnet\Bundle\WebpackBundle\DependencyInjection\WebpackExtension
*/
class WebpackExtensionTest extends TestCase
{
use ProphecyTrait;

public function testAlias(): void
{
self::assertEquals(Configuration::CONFIG_ROOT, (new WebpackExtension())->getAlias());
Expand Down
3 changes: 3 additions & 0 deletions test/Bundle/EventListener/RequestListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@

use Hostnet\Component\Webpack\Asset\CacheGuard;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;

/**
* @covers \Hostnet\Bundle\WebpackBundle\EventListener\RequestListener
*/
class RequestListenerTest extends TestCase
{
use ProphecyTrait;

public function testRequestNoMasterRequest(): void
{
$event = $this->prophesize(GetResponseEvent::class);
Expand Down
3 changes: 3 additions & 0 deletions test/Bundle/Twig/Token/WebpackTokenParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@

use Hostnet\Bundle\WebpackBundle\Twig\TwigExtension;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Twig\Loader\LoaderInterface;

/**
* @covers \Hostnet\Bundle\WebpackBundle\Twig\Token\WebpackTokenParser
*/
class WebpackTokenParserTest extends TestCase
{
use ProphecyTrait;

public function testParser(): void
{
$loader = $this->prophesize(LoaderInterface::class)->reveal();
Expand Down
5 changes: 4 additions & 1 deletion test/Bundle/Twig/TwigExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
namespace Hostnet\Bundle\WebpackBundle\Twig;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Twig\Loader\LoaderInterface;

/**
* @covers \Hostnet\Bundle\WebpackBundle\Twig\TwigExtension
*/
class TwigExtensionTest extends TestCase
{
use ProphecyTrait;

public function testExtension(): void
{
$loader = $this->prophesize(LoaderInterface::class)->reveal();
Expand All @@ -35,7 +38,7 @@ public function testAssets($expected, $asset, $web_dir, $dump_path, $public_path
self::assertEquals($expected, $extension->webpackPublic($asset));
}

public function assetProvider()
public function assetProvider(): iterable
{
return [
['/bundles/img.png', 'img.png', __DIR__ . '/web/', '/bundles/', '/'],
Expand Down
3 changes: 3 additions & 0 deletions test/Bundle/WebpackBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@

use Hostnet\Bundle\WebpackBundle\DependencyInjection\WebpackCompilerPass;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
* @covers \Hostnet\Bundle\WebpackBundle\WebpackBundle
*/
class WebpackBundleTest extends TestCase
{
use ProphecyTrait;

public function testBuild(): void
{
$bundle = new WebpackBundle();
Expand Down
3 changes: 3 additions & 0 deletions test/Component/Asset/CacheGuardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
namespace Hostnet\Component\Webpack\Asset;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Log\LoggerInterface;

/**
* @covers \Hostnet\Component\Webpack\Asset\CacheGuard
*/
class CacheGuardTest extends TestCase
{
use ProphecyTrait;

/**
* Simple test for the case the cache is outdated.
*/
Expand Down
3 changes: 3 additions & 0 deletions test/Component/Asset/TemplateFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@

use Hostnet\Fixture\WebpackBundle\Bundle\BarBundle\BarBundle;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\HttpKernel\Kernel;

/**
* @covers \Hostnet\Component\Webpack\Asset\TemplateFinder
*/
class TemplateFinderTest extends TestCase
{
use ProphecyTrait;

public function testFindAllTemplates(): void
{
$kernel = $this->prophesize(Kernel::class);
Expand Down
Loading