Skip to content

Commit 88ffc0a

Browse files
authored
Merge pull request #21 from smartboxgroup/feature/sf-3
Allow Symfony 3.X applications
2 parents 937d591 + e2f6258 commit 88ffc0a

9 files changed

Lines changed: 93 additions & 2138 deletions

File tree

.travis.yml

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,58 @@
1+
# See: https://symfony.com/doc/current/bundles/best_practices.html#continuous-integration
12
language: php
3+
sudo: false
4+
cache:
5+
directories:
6+
- $HOME/.composer/cache/files
7+
- $HOME/symfony-bridge/.phpunit
28

3-
php:
4-
- 7.0
5-
- 7.1
6-
- 7.2
7-
- 7.3
9+
env:
10+
global:
11+
- PHPUNIT_FLAGS="-v"
12+
- SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
813

914
matrix:
10-
allow_failures:
11-
- php: 7.3
15+
fast_finish: true
16+
include:
17+
# Test the latest stable release
18+
- php: 7.0
19+
- php: 7.1
20+
- php: 7.2
21+
env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"
22+
23+
# Test LTS versions. This makes sure we do not use Symfony packages with version greater
24+
# than 2 or 3 respectively. Read more at https://github.com/symfony/lts
25+
- php: 7.2
26+
env: DEPENDENCIES="symfony/lts:^3"
27+
28+
# Latest commit to master
29+
- php: 7.2
30+
env: STABILITY="dev"
1231

13-
env:
14-
- SYMFONY_VERSION=2.8.*
15-
- SYMFONY_VERSION=3.4.*
32+
allow_failures:
33+
# Dev-master is allowed to fail.
34+
- env: STABILITY="dev"
1635

1736
before_install:
18-
- phpenv config-add travis/z_php.ini
37+
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
38+
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
39+
- if ! [ -v "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
1940

20-
before_script:
21-
- composer install --prefer-dist --no-interaction
41+
install:
42+
# To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
43+
- if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi
44+
- composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
45+
- ./vendor/bin/simple-phpunit install
2246

2347
script:
24-
- SYMFONY_PHPUNIT_VERSION=6.5 SYMFONY_DEPRECATIONS_HELPER=weak_vendors bin/simple-phpunit --coverage-text
48+
- composer validate --strict --no-check-lock
49+
# simple-phpunit is the PHPUnit wrapper provided by the PHPUnit Bridge component and
50+
# it helps with testing legacy code and deprecations (composer require symfony/phpunit-bridge)
51+
- SYMFONY_DEPRECATIONS_HELPER="weak_vendors" ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS
2552

2653
notifications:
2754
email:
2855
recipients:
2956
- si-integration@smartandco.com
3057
on_success: change
3158
on_failure: always
32-

DependencyInjection/SerializationCacheCompilerPass.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,21 @@ public function process(ContainerBuilder $container)
5151
throw new \Exception("The class '$class' configured in smartbox_core.serialization_cache.cached_visitors does not have the data property and can not be cached.");
5252
}
5353
}
54+
$public = $container->getParameter('kernel.debug');
5455

5556
// Serialization cache subscriber
56-
$serializationCacheSubscriber = $container->setDefinition(
57-
'smartcore.serializer.subscriber.cache',
58-
new Definition(CacheEventsSubscriber::class, [
59-
$vistorClasses,
60-
])
61-
);
57+
$serializationCacheSubscriber = $container->register('smartcore.serializer.subscriber.cache', CacheEventsSubscriber::class);
58+
$serializationCacheSubscriber->setArguments([$vistorClasses]);
6259
$serializationCacheSubscriber->addMethodCall('setCacheService', [$cacheDriverServiceDef]);
6360
$serializationCacheSubscriber->addTag('jms_serializer.event_subscriber');
61+
$serializationCacheSubscriber->setPublic($public);
62+
6463

6564
// Serialization cache handler
66-
$serializationCacheHandler = $container->setDefinition(
67-
'smartcore.serializer.handler.cache',
68-
new Definition(CachedObjectHandler::class)
69-
);
65+
$serializationCacheHandler = $container->register('smartcore.serializer.handler.cache',CachedObjectHandler::class);
7066
$serializationCacheHandler->addMethodCall('setCacheService', [$cacheDriverServiceDef]);
7167
$serializationCacheHandler->addTag('jms_serializer.subscribing_handler');
68+
$serializationCacheHandler->setPublic($public);
7269
}
7370
}
7471
}

Resources/config/services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ services:
103103
smartcore.generator.random_fixture:
104104
class: '%smartcore.generator.random_fixture.class%'
105105
arguments: ['@jms_serializer.metadata_factory', '@smartcore.helper.entity_namespace_resolver']
106+
public: '%kernel.debug%'
106107

107108
## SMOKE TESTS ##
108109
# COMMAND

Tests/Command/Fixtures/GenerateRandomFixtureCommandTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Symfony\Component\DependencyInjection\ContainerInterface;
1414

1515
/**
16-
* Class GenerateRandomFixtureCommandTest.
16+
* @group legacy
1717
*
1818
* @coversDefaultClass \Smartbox\CoreBundle\Command\Fixtures\GenerateRandomFixtureCommand
1919
*/
@@ -62,8 +62,6 @@ public function dataProviderForEntityGeneration()
6262
*/
6363
public function testExecute($group, $version)
6464
{
65-
$this->application->add($this->container->get('smartbox_core.command_fixtures.generate_random_fixture_command'));
66-
6765
$command = $this->application->find('smartbox:core:generate:random-fixture');
6866
$commandTester = new CommandTester($command);
6967

0 commit comments

Comments
 (0)