Skip to content

Commit

Permalink
Merge pull request #1035 from sebastianblum/extending-travis-build-ma…
Browse files Browse the repository at this point in the history
…trix

[CI] Extend and enhance Travis build matrix
  • Loading branch information
robfrawley committed Jan 30, 2018
2 parents 2f04681 + 3253b6d commit c676dee
Show file tree
Hide file tree
Showing 18 changed files with 116 additions and 185 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
45 changes: 33 additions & 12 deletions .travis.yml
Expand Up @@ -9,34 +9,55 @@ 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
- php: 7.2
env: SYMFONY_VERSION=3.4.*
- php: 7.2
env: SYMFONY_VERSION=4.0.*
- php: 7.2
env: SYMFONY_VERSION=3.4.*
env:
- DEPENDENCIES="symfony/phpunit-bridge:^4"
- COMPOSER_UPDATE_OPTIONS="--no-dev"
- php: 7.2
env: SYMFONY_VERSION=dev-master
env:
- ENABLE_CODE_COVERAGE="true"
- php: 7.2
env:
- SYMFONY_VERSION=dev-master
- STABILITY=dev
- php: nightly
env: SYMFONY_VERSION=4.0.*
allow_failures:
- env: SYMFONY_VERSION=dev-master
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.

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');
}
}
4 changes: 4 additions & 0 deletions Tests/DependencyInjection/LiipImagineExtensionTest.php
Expand Up @@ -109,6 +109,10 @@ protected function createEmptyConfiguration()

protected function createFullConfiguration()
{
if (!class_exists(Parser::class)) {
$this->markTestSkipped('Requires the symfony/yaml package.');
}

$this->containerBuilder = new ContainerBuilder();
$loader = new LiipImagineExtension();
$loader->addLoaderFactory(new FileSystemLoaderFactory());
Expand Down
8 changes: 8 additions & 0 deletions Tests/Form/Type/ImageTypeTest.php
Expand Up @@ -13,6 +13,7 @@

use Liip\ImagineBundle\Form\Type\ImageType;
use Liip\ImagineBundle\Tests\AbstractTest;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
Expand All @@ -23,6 +24,13 @@
*/
class ImageTypeTest extends AbstractTest
{
protected function setUp()
{
if (!class_exists(AbstractType::class)) {
$this->markTestSkipped('Requires the symfony/form package.');
}
}

public function testGetName()
{
$type = new ImageType();
Expand Down
13 changes: 13 additions & 0 deletions Tests/Functional/AbstractWebTestCase.php
Expand Up @@ -12,9 +12,22 @@
namespace Liip\ImagineBundle\Tests\Functional;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Client;

abstract class AbstractWebTestCase extends WebTestCase
{
/**
* {@inheritdoc}
*/
public static function createClient(array $options = array(), array $server = array())
{
if (!class_exists(Client::class)) {
self::markTestSkipped("Requires the symfony/browser-kit package.");
}

return parent::createClient($options, $server);
}

/**
* @return string
*/
Expand Down
4 changes: 4 additions & 0 deletions Tests/Imagine/Cache/Resolver/AmazonS3ResolverTest.php
Expand Up @@ -340,6 +340,10 @@ protected function createCFResponseMock($ok = true)
*/
protected function createAmazonS3Mock()
{
if (!class_exists(\AmazonS3::class)) {
$this->markTestSkipped('Requires the amazonwebservices/aws-sdk-for-php package.');
}

return $this
->getMockBuilder(\AmazonS3::class)
->disableOriginalConstructor()
Expand Down
9 changes: 9 additions & 0 deletions Tests/Imagine/Cache/Resolver/CacheResolverTest.php
Expand Up @@ -25,6 +25,15 @@ class CacheResolverTest extends AbstractTest
protected $filter = 'thumbnail';
protected $path = 'MadCat2.jpeg';
protected $webPath = '/media/cache/thumbnail/MadCat2.jpeg';

protected function setUp()
{
if (!class_exists(ArrayCache::class)) {
$this->markTestSkipped('Requires the doctrine/cache package.');
}

parent::setUp();
}

public function testResolveIsSavedToCache()
{
Expand Down

0 comments on commit c676dee

Please sign in to comment.