Skip to content

Run php-cs-fixer over the bundle using preexisting .php_cs.dist rules #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion src/Asset/EntrypointLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getIntegrityData(): array
{
$entriesData = $this->getEntriesData();

if (!array_key_exists('integrity', $entriesData)) {
if (!\array_key_exists('integrity', $entriesData)) {
return [];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Asset/EntrypointLookupCollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface EntrypointLookupCollectionInterface
/**
* Retrieve the EntrypointLookupInterface for the given build.
*
* @throws UndefinedBuildException If the build does not exist.
* @throws UndefinedBuildException if the build does not exist
*/
public function getEntrypointLookup(string $buildName = null): EntrypointLookupInterface;
}
13 changes: 10 additions & 3 deletions tests/Asset/EntrypointLookupCollectionTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of the Symfony WebpackEncoreBundle package.
* (c) Fabien Potencier <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\WebpackEncoreBundle\Tests\Asset;

use Symfony\Component\DependencyInjection\ServiceLocator;
Expand All @@ -10,7 +17,7 @@
class EntrypointLookupCollectionTest extends TestCase
{
/**
* @expectedException Symfony\WebpackEncoreBundle\Exception\UndefinedBuildException
* @expectedException \Symfony\WebpackEncoreBundle\Exception\UndefinedBuildException
* @expectedExceptionMessage The build "something" is not configured
*/
public function testExceptionOnMissingEntry()
Expand All @@ -20,7 +27,7 @@ public function testExceptionOnMissingEntry()
}

/**
* @expectedException Symfony\WebpackEncoreBundle\Exception\UndefinedBuildException
* @expectedException \Symfony\WebpackEncoreBundle\Exception\UndefinedBuildException
* @expectedExceptionMessage There is no default build configured: please pass an argument to getEntrypointLookup().
*/
public function testExceptionOnMissingDefaultBuildEntry()
Expand All @@ -32,7 +39,7 @@ public function testExceptionOnMissingDefaultBuildEntry()
public function testDefaultBuildIsReturned()
{
$lookup = $this->createMock(EntrypointLookupInterface::class);
$collection = new EntrypointLookupCollection(new ServiceLocator(['the_default' => function() use ($lookup) { return $lookup; }]), 'the_default');
$collection = new EntrypointLookupCollection(new ServiceLocator(['the_default' => function () use ($lookup) { return $lookup; }]), 'the_default');

$this->assertSame($lookup, $collection->getEntrypointLookup());
}
Expand Down
17 changes: 11 additions & 6 deletions tests/Asset/EntrypointLookupTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<?php

/*
* This file is part of the Symfony WebpackEncoreBundle package.
* (c) Fabien Potencier <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\WebpackEncoreBundle\Tests\Asset;

use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\NullAdapter;
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookup;
use PHPUnit\Framework\TestCase;
use Symfony\WebpackEncoreBundle\Exception\EntrypointNotFoundException;

class EntrypointLookupTest extends TestCase
{
Expand Down Expand Up @@ -121,7 +126,7 @@ public function testMissingIntegrityData()
public function testExceptionOnInvalidJson()
{
$filename = tempnam(sys_get_temp_dir(), 'WebpackEncoreBundle');
file_put_contents($filename, "abcd");
file_put_contents($filename, 'abcd');

$this->entrypointLookup = new EntrypointLookup($filename);
$this->entrypointLookup->getJavaScriptFiles('an_entry');
Expand All @@ -134,7 +139,7 @@ public function testExceptionOnInvalidJson()
public function testExceptionOnMissingEntrypointsKeyInJson()
{
$filename = tempnam(sys_get_temp_dir(), 'WebpackEncoreBundle');
file_put_contents($filename, "{}");
file_put_contents($filename, '{}');

$this->entrypointLookup = new EntrypointLookup($filename);
$this->entrypointLookup->getJavaScriptFiles('an_entry');
Expand All @@ -151,7 +156,7 @@ public function testExceptionOnBadFilename()
}

/**
* @expectedException Symfony\WebpackEncoreBundle\Exception\EntrypointNotFoundException
* @expectedException \Symfony\WebpackEncoreBundle\Exception\EntrypointNotFoundException
* @expectedExceptionMessage Could not find the entry
*/
public function testExceptionOnMissingEntry()
Expand All @@ -160,7 +165,7 @@ public function testExceptionOnMissingEntry()
}

/**
* @expectedException Symfony\WebpackEncoreBundle\Exception\EntrypointNotFoundException
* @expectedException \Symfony\WebpackEncoreBundle\Exception\EntrypointNotFoundException
* @expectedExceptionMessage Try "my_entry" instead
*/
public function testExceptionOnEntryWithExtension()
Expand Down
15 changes: 11 additions & 4 deletions tests/Asset/TagRendererTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of the Symfony WebpackEncoreBundle package.
* (c) Fabien Potencier <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\WebpackEncoreBundle\Tests\Asset;

use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -30,7 +37,7 @@ public function testRenderScriptTags()
['/build/file1.js', 'custom_package'],
['/build/file2.js', 'custom_package']
)
->willReturnCallback(function($path) {
->willReturnCallback(function ($path) {
return 'http://localhost:8080'.$path;
});
$renderer = new TagRenderer($entrypointCollection, $packages);
Expand Down Expand Up @@ -61,7 +68,7 @@ public function testRenderScriptTagsWithBadFilename()
$packages = $this->createMock(Packages::class);
$packages->expects($this->once())
->method('getUrl')
->willReturnCallback(function($path) {
->willReturnCallback(function ($path) {
return 'http://localhost:8080'.$path;
});
$renderer = new TagRenderer($entrypointCollection, $packages);
Expand Down Expand Up @@ -107,7 +114,7 @@ public function testRenderScriptTagsWithinAnEntryPointCollection()
['/build/file2.js', null],
['/build/file3.js', 'specific_package']
)
->willReturnCallback(function($path) {
->willReturnCallback(function ($path) {
return 'http://localhost:8080'.$path;
});
$renderer = new TagRenderer($entrypointCollection, $packages);
Expand Down Expand Up @@ -158,7 +165,7 @@ public function testRenderScriptTagsWithHashes()
['/build/file2.js', 'custom_package']
)
->willReturnCallback(function ($path) {
return 'http://localhost:8080' . $path;
return 'http://localhost:8080'.$path;
});
$renderer = new TagRenderer($entrypointCollection, $packages, true);

Expand Down
17 changes: 12 additions & 5 deletions tests/IntegrationTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of the Symfony WebpackEncoreBundle package.
* (c) Fabien Potencier <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\WebpackEncoreBundle\Tests;

use Symfony\Component\DependencyInjection\Reference;
Expand Down Expand Up @@ -28,7 +35,7 @@ public function testTwigIntegration()
$html1
);
$this->assertContains(
'<link rel="stylesheet" href="/build/styles.css" integrity="sha384-4g+Zv0iELStVvA4/B27g4TQHUMwZttA5TEojjUyB8Gl5p7sarU4y+VTSGMrNab8n">' .
'<link rel="stylesheet" href="/build/styles.css" integrity="sha384-4g+Zv0iELStVvA4/B27g4TQHUMwZttA5TEojjUyB8Gl5p7sarU4y+VTSGMrNab8n">'.
'<link rel="stylesheet" href="/build/styles2.css" integrity="sha384-hfZmq9+2oI5Cst4/F4YyS2tJAAYdGz7vqSMP8cJoa8bVOr2kxNRLxSw6P8UZjwUn">',
$html1
);
Expand Down Expand Up @@ -129,7 +136,7 @@ public function registerBundles()

public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(function(ContainerBuilder $container) {
$loader->load(function (ContainerBuilder $container) {
$container->loadFromExtension('framework', [
'secret' => 'foo',
'assets' => [
Expand All @@ -139,7 +146,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)

$container->loadFromExtension('twig', [
'paths' => [
__DIR__.'/fixtures' => 'integration_test'
__DIR__.'/fixtures' => 'integration_test',
],
'strict_variables' => true,
]);
Expand All @@ -148,8 +155,8 @@ public function registerContainerConfiguration(LoaderInterface $loader)
'output_path' => __DIR__.'/fixtures/build',
'cache' => true,
'builds' => [
'different_build' => __DIR__.'/fixtures/different_build'
]
'different_build' => __DIR__.'/fixtures/different_build',
],
]);

$container->register(WebpackEncoreCacheWarmerTester::class)
Expand Down