Skip to content

Commit

Permalink
Merge branch '2.0' into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianbloching committed Feb 1, 2018
2 parents e298358 + 63e3fad commit 3a33c13
Show file tree
Hide file tree
Showing 32 changed files with 167 additions and 218 deletions.
4 changes: 2 additions & 2 deletions .coveralls.yml
@@ -1,4 +1,4 @@
---

service_name: travis-ci
src_dir: .
coverage_clover : var/build/clover.xml
json_path : var/build/coveralls-upload.json
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,5 +4,6 @@
/composer.phar
/vendor/
/Tests/Functional/app/web/media/cache
/Tests/Functional/app/public/media/cache
/.idea/
/var/
50 changes: 38 additions & 12 deletions .travis.yml
Expand Up @@ -9,32 +9,58 @@ cache:
env:
global:
- SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
- ENABLE_CODE_COVERAGE="false"

matrix:
fast_finish: true
include:
- php: 7.1
env: SYMFONY_VERSION=4.0.*
- php: 7.1
env:
- SYMFONY_VERSION=4.0.*
- COMPOSER_FLAGS="--prefer-lowest"
- DEPENDENCIES="symfony/phpunit-bridge:^4"
- php: 7.2
env: SYMFONY_VERSION=4.0.*
- php: 7.2
env: SYMFONY_VERSION=3.4.*
- php: 7.2
env: SYMFONY_VERSION=dev-master
- php: nightly
env: SYMFONY_VERSION=4.0.*
allow_failures:
- env: SYMFONY_VERSION=dev-master
- php: 7.2
env:
- DEPENDENCIES="symfony/phpunit-bridge:^4"
- COMPOSER_UPDATE_OPTIONS="--no-dev"
- php: 7.2
env:
- ENABLE_CODE_COVERAGE="true"
- php: 7.2
env:
- SYMFONY_VERSION=dev-master
- STABILITY=dev
- php: nightly

env:
- SYMFONY_VERSION=4.0.*
- COMPOSER_FLAGS="--ignore-platform-reqs"
allow_failures:
- env:
- ENABLE_CODE_COVERAGE="true"
- env:
- SYMFONY_VERSION=dev-master
- STABILITY=dev
- php: nightly

before_install:
- bash ./.travis/exec-before.bash
- if [[ "$SYMFONY_VERSION" != "" ]]; then travis_retry composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update $COMPOSER_FLAGS; fi;
- if [[ "$DEPENDENCIES" != "" ]]; then travis_retry composer require ${DEPENDENCIES} --no-update $COMPOSER_FLAGS; fi;
- if [[ "$STABILITY" != "" ]]; then composer config minimum-stability $STABILITY; fi
- if [[ "$ENABLE_CODE_COVERAGE" != "true" && "$TRAVIS_EVENT_TYPE" != "cron" ]]; then phpenv config-rm xdebug.ini || true; fi;
- if [[ "$ENABLE_CODE_COVERAGE" != "true" && "$TRAVIS_EVENT_TYPE" != "cron" ]]; then travis_retry composer require satooshi/php-coveralls:^1.0 --no-update $COMPOSER_FLAGS; fi;

install:
- travis_retry composer require "symfony/symfony:${SYMFONY_VERSION}" $COMPOSER_FLAGS
- travis_retry composer update --prefer-dist --no-interaction --no-suggest --no-progress --ansi $COMPOSER_FLAGS $COMPOSER_UPDATE_OPTIONS
- if [[ "$ENABLE_CODE_COVERAGE" == "true" && "$TRAVIS_EVENT_TYPE" == "cron" ]]; then travis_retry composer require --dev satooshi/php-coveralls; fi

script:
- ./vendor/bin/simple-phpunit -vvv
- if [[ "$ENABLE_CODE_COVERAGE" == "true" && "$TRAVIS_EVENT_TYPE" == "cron" ]]; then vendor/bin/simple-phpunit --coverage-text --coverage-clover build/logs/clover.xml; else vendor/bin/simple-phpunit -v; fi;

after_script:
- bash ./.travis/exec-after.bash
after_success:
- if [[ "$ENABLE_CODE_COVERAGE" == "true" && "$TRAVIS_EVENT_TYPE" == "cron" ]]; then php vendor/bin/coveralls -v --config .coveralls.yml; fi;
10 changes: 0 additions & 10 deletions .travis/composer/config.json

This file was deleted.

24 changes: 0 additions & 24 deletions .travis/exec-after.bash

This file was deleted.

24 changes: 0 additions & 24 deletions .travis/exec-before.bash

This file was deleted.

66 changes: 0 additions & 66 deletions .travis/inc-functions.bash

This file was deleted.

5 changes: 0 additions & 5 deletions .travis/inc-variables.bash

This file was deleted.

Expand Up @@ -12,6 +12,7 @@
namespace Liip\ImagineBundle\DependencyInjection\Factory\Loader;

use Liip\ImagineBundle\Exception\InvalidArgumentException;
use Liip\ImagineBundle\Utility\Framework\SymfonyFramework;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
Expand Down Expand Up @@ -59,7 +60,7 @@ public function addConfiguration(ArrayNodeDefinition $builder)
->end()
->treatNullLike([])
->treatFalseLike([])
->defaultValue(['%kernel.root_dir%/../web'])
->defaultValue([SymfonyFramework::getContainerResolvableRootWebPath()])
->prototype('scalar')
->cannotBeEmpty()
->end()
Expand Down
Expand Up @@ -11,6 +11,7 @@

namespace Liip\ImagineBundle\DependencyInjection\Factory\Resolver;

use Liip\ImagineBundle\Utility\Framework\SymfonyFramework;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;

Expand Down Expand Up @@ -50,7 +51,7 @@ public function addConfiguration(ArrayNodeDefinition $builder)
$builder
->children()
->scalarNode('web_root')
->defaultValue('%kernel.root_dir%/../web')
->defaultValue(SymfonyFramework::getContainerResolvableRootWebPath())
->cannotBeEmpty()
->end()
->scalarNode('cache_prefix')
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/imagine.xml
Expand Up @@ -48,7 +48,7 @@
<argument>%liip_imagine.default_image%</argument>
</service>

<service id="liip_imagine.cache.manager" class="Liip\ImagineBundle\Imagine\Cache\CacheManager">
<service id="liip_imagine.cache.manager" class="Liip\ImagineBundle\Imagine\Cache\CacheManager" public="true">
<argument type="service" id="liip_imagine.filter.configuration" />
<argument type="service" id="router" />
<argument type="service" id="liip_imagine.cache.signer" />
Expand Down
10 changes: 6 additions & 4 deletions Resources/doc/cache-resolver/web_path.rst
Expand Up @@ -35,16 +35,18 @@ Configuration
resolvers:
profile_photos:
web_path:
web_root: "%kernel.root_dir%/../web"
# use %kernel.project_dir%/web for Symfony prior to 4.0.0
web_root: "%kernel.project_dir%/public"
cache_prefix: "media/cache"
There are several configuration options available:

* ``web_root`` - must be the absolute path to you application's web root. This
is used to determine where to put generated image files, so that apache
will pick them up before handing the request to Symfony2 next time they
are requested.
Default value: ``%kernel.root_dir%/../web``
will pick them up before handing the request to Symfony next time they
are requested. The default value ends with ``web`` for Symfony prior to
version ``4.0.0``.
Default value: ``%kernel.project_dir%/(public|web)``
* ``cache_prefix`` - this is also used in the path for image generation, so
as to not clutter your web root with cached images. For example by default,
the images would be written to the ``web/media/cache/`` directory.
Expand Down
4 changes: 2 additions & 2 deletions Resources/doc/configuration.rst
Expand Up @@ -13,13 +13,13 @@ The default configuration for the bundle looks like this:
resolvers:
default:
web_path:
web_root: ~ # %kernel.root_dir%/../web
web_root: ~ # %kernel.project_dir%/public (%kernel.project_dir%/web for Symfony < 4.0.0)
cache_prefix: ~ # media/cache
loaders:
default:
filesystem:
data_root: ~ # %kernel.root_dir%/../web/
data_root: ~ # %kernel.project_dir%/public (%kernel.project_dir%/web for Symfony < 4.0.0)
driver: gd
cache: default
Expand Down
4 changes: 4 additions & 0 deletions Tests/Binary/Loader/AbstractDoctrineLoaderTest.php
Expand Up @@ -32,6 +32,10 @@ class AbstractDoctrineLoaderTest extends \PHPUnit\Framework\TestCase

public function setUp()
{
if (!interface_exists(ObjectManager::class)) {
$this->markTestSkipped('Requires the doctrine/orm package.');
}

$this->om = $this
->getMockBuilder(ObjectManager::class)
->getMock();
Expand Down
25 changes: 12 additions & 13 deletions Tests/Binary/Loader/FlysystemLoaderTest.php
Expand Up @@ -38,38 +38,37 @@ public function setUp()
$this->flyFilesystem = new Filesystem(new Local($this->fixturesPath));
}

public function getLoader()
/**
* @return FlysystemLoader
*/
public function getFlysystemLoader()
{
return new FlysystemLoader(ExtensionGuesser::getInstance(), $this->flyFilesystem);
}

/**
* @depends getLoader
*/
public function testShouldImplementLoaderInterface(LoaderInterface $loader)
public function testShouldImplementLoaderInterface()
{
$this->assertInstanceOf(LoaderInterface::class, $loader);
$this->assertInstanceOf(LoaderInterface::class, $this->getFlysystemLoader());
}

/**
* @depends getLoader
*/
public function testReturnImageContentOnFind(LoaderInterface $loader)
public function testReturnImageContentOnFind()
{
$loader = $this->getFlysystemLoader();

$this->assertSame(
file_get_contents($this->fixturesPath.'/assets/cats.jpeg'),
$loader->find('assets/cats.jpeg')->getContent()
);
}

/**
* @depends getLoader
*
* @expectedException \Liip\ImagineBundle\Exception\Binary\Loader\NotLoadableException
* @expectedExceptionMessageRegExp {Source image .+ not found}
*/
public function testThrowsIfInvalidPathGivenOnFind(LoaderInterface $loader)
public function testThrowsIfInvalidPathGivenOnFind()
{
$loader = $this->getFlysystemLoader();

$loader->find('invalid.jpeg');
}
}
Expand Up @@ -16,6 +16,7 @@
use Liip\ImagineBundle\Tests\DependencyInjection\Factory\FactoryTestCase;
use Liip\ImagineBundle\Tests\Functional\Fixtures\BarBundle\LiipBarBundle;
use Liip\ImagineBundle\Tests\Functional\Fixtures\FooBundle\LiipFooBundle;
use Liip\ImagineBundle\Utility\Framework\SymfonyFramework;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -252,7 +253,7 @@ public function testProcessCorrectlyOptionsOnAddConfiguration()

public function testAddDefaultOptionsIfNotSetOnAddConfiguration()
{
$expectedDataRoot = array('%kernel.root_dir%/../web');
$expectedDataRoot = array(SymfonyFramework::getContainerResolvableRootWebPath());

$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('filesystem', 'array');
Expand All @@ -270,7 +271,7 @@ public function testAddDefaultOptionsIfNotSetOnAddConfiguration()

public function testAddAsScalarExpectingArrayNormalizationOfConfiguration()
{
$expectedDataRoot = array('%kernel.root_dir%/../web');
$expectedDataRoot = array(SymfonyFramework::getContainerResolvableRootWebPath());

$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('filesystem', 'array');
Expand Down

0 comments on commit 3a33c13

Please sign in to comment.