Skip to content

Commit

Permalink
Merge pull request #1 from yethee/default-config
Browse files Browse the repository at this point in the history
Added ability to use the bundle with default config
  • Loading branch information
ju1ius committed Jan 11, 2016
2 parents c5ef4e0 + 5ab07c8 commit c604a56
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 36 deletions.
37 changes: 2 additions & 35 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,4 @@
# Cache and logs (Symfony2)
/app/cache/*
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep

# Cache and logs (Symfony3)
/var/cache/*
/var/logs/*
!var/cache/.gitkeep
!var/logs/.gitkeep

# Parameters
/app/config/parameters.yml
/app/config/parameters.ini

# Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
/vendor/

# Assets and user uploads
/web/bundles/
/web/uploads/

# PHPUnit
/app/phpunit.xml
/phpunit.xml

# Build data
/build/

# Composer PHAR
/composer.phar
/composer.lock
/phpunit.xml
1 change: 0 additions & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public function getConfigTreeBuilder()

$rootNode->children()
->scalarNode('revision_manifest')
->isRequired()
->cannotBeEmpty()
->defaultValue('%kernel.root_dir%/../webpack-assets.json')
->end()
Expand Down
62 changes: 62 additions & 0 deletions Tests/DependencyInjection/Ju1iusWebpackAssetsExtensionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

namespace ju1ius\WebpackAssetsBundle\Tests\DependencyInjection;

use ju1ius\WebpackAssetsBundle\DependencyInjection\Ju1iusWebpackAssetsExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class Ju1iusWebpackAssetsExtensionTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ContainerBuilder;
*/
private $container;

/**
* @var Ju1iusWebpackAssetsExtension;
*/
private $extension;

public function testLoadWithDefaults()
{
$this->extension->load(array(), $this->container);

$this->assertTrue($this->container->hasDefinition('ju1ius_webpack_assets.asset_helper'));
$this->assertEquals(
array(
'%kernel.root_dir%/../webpack-assets.json'
),
$this->container->getDefinition('ju1ius_webpack_assets.asset_helper')->getArguments()
);
}

public function testLoadWithCustomConfig()
{
$this->extension->load(
array(
'ju1ius_webpack_assets' => array(
'revision_manifest' => 'rev-manifest.json'
)
),
$this->container
);

$this->assertEquals(
array(
'rev-manifest.json'
),
$this->container->getDefinition('ju1ius_webpack_assets.asset_helper')->getArguments()
);
}

protected function setUp()
{
$this->container = new ContainerBuilder();
$this->extension = new Ju1iusWebpackAssetsExtension();
}

protected function tearDown()
{
unset($this->container, $this->extension);
}
}
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
],
"require": {
"php": ">=5.4.0",
"symfony/config": "^2.7|^3.0",
"symfony/dependency-injection": "^2.7|^3.0",
"symfony/twig-bundle": "^2.7|^3.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0"
},
"autoload": {
"psr-4": { "ju1ius\\WebpackAssetsBundle\\": "" }
},
Expand Down
20 changes: 20 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Ju1iusWebpackAssetsBundle">
<directory>./Tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>.</directory>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

0 comments on commit c604a56

Please sign in to comment.