Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
Updated compatibility to PHP 7.4 (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
RSalo committed Oct 29, 2020
1 parent e75be14 commit 29705ed
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 52 deletions.
26 changes: 6 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#######################################################
# DO NOT EDIT THIS FILE! #
# #
# It's auto-generated by symfony-cmf/dev-kit package. #
#######################################################

############################################################################
# This file is part of the Symfony CMF package. #
# #
Expand All @@ -16,7 +10,9 @@
language: php

php:
- 7.1
- 7.2
- 7.3
- 7.4

sudo: false

Expand All @@ -26,34 +22,24 @@ cache:
- $HOME/.composer/cache/files

env:
matrix: SYMFONY_VERSION=4.0.*
global:
- SYMFONY_DEPRECATIONS_HELPER="/.*each.*/"
- SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml"
- KERNEL_CLASS=Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel
- SYMFONY_PHPUNIT_VERSION=5.7
- TEST_INSTALLATION=false

matrix:
include:
- php: 7.2
env: STABILITY=dev SYMFONY_VERSION=4.0.*
- php: 7.1
env: STABILITY=dev COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=2.8.* SYMFONY_DEPRECATIONS_HELPER=weak
- php: 7.2
env: STABILITY=dev SYMFONY_VERSION=3.3.*
- php: 7.2
env: STABILITY=dev SYMFONY_VERSION=3.4.*
- PHP: 7.2
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_DEPRECATIONS_HELPER=weak
- env: TEST_INSTALLATION=true
fast_finish: true
allow_failures:
- env: TEST_INSTALLATION=true

before_install:
- phpenv config-rm xdebug.ini || true
- composer self-update
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; composer config prefer-stable true; fi;
- if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi
- composer self-update --2
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)

install: COMPOSER_MEMORY_LIMIT=-1 travis_wait composer update --prefer-dist $COMPOSER_FLAGS
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
Changelog
=========

1.2.0
-----
* Increased minimum version PHP to 7.2.
* Updated several packages
* Added support for PHP 7.4

1.0.0
-----

Released.
* Released.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ KERNEL_CLASS="Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel" .


## Requirements

* PHP 7.1 / 7.2
* Symfony 2.8 / 3.3 / 3.4 / 4.0
* See also the `require` section of [composer.json](composer.json)

## Documentation
Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,29 @@
}
],
"require": {
"php": "^7.1",
"php": "^7.2",
"symfony-cmf/resource-bundle": "^1.0",
"jms/serializer-bundle": "^1.0 | ^2.0 | ^3.0",
"symfony/translation": "^2.8 || ^3.3 || ^4.0"
},
"require-dev": {
"symfony-cmf/testing": "^2.1@dev",
"symfony/phpunit-bridge": "^3.3 || ^4.0",
"symfony/phpunit-bridge": "^5",
"doctrine/phpcr-odm": "^1.4|^2.0",
"jms/serializer": "^1.2",
"behat/behat": "^3.0.6",
"behat/web-api-extension": "^1.0@dev",
"matthiasnoback/symfony-dependency-injection-test": "^1.1",
"matthiasnoback/symfony-config-test": "^2.1",
"imbo/behat-api-extension": "^2.1",
"matthiasnoback/symfony-dependency-injection-test": "^4",
"matthiasnoback/symfony-config-test": "^4",
"symfony/twig-bundle": "^2.8 || ^3.3 || ^4.0",
"symfony/validator": "^2.8 || ^3.3 || ^4.0",
"symfony/security-bundle": "^2.8 || ^3.3 || ^4.0",
"symfony/asset": "^2.8 || ^3.3 || ^4.0",
"symfony/templating": "^2.8 || ^3.3 || ^4.0",
"symfony/form": "^2.8 || ^3.3 || ^4.0",
"symfony/web-server-bundle": "^2.8 || ^3.3 || ^4.0",
"symfony/translation": "^2.8 || ^3.3 || ^4.0"
"symfony/translation": "^2.8 || ^3.3 || ^4.0",
"phpspec/prophecy": "^1.12"
},
"suggest": {
"doctrine/phpcr-odm": "To enable support for the PHPCR ODM documents (^1.2)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Bundle\ResourceBundle\Tests\Unit\DependencyInjection;
namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Unit\DependencyInjection;

use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
use Symfony\Cmf\Bundle\ResourceRestBundle\DependencyInjection\CmfResourceRestExtension;

class CmfResourceRestExtensionTest extends AbstractExtensionTestCase
{
protected function getContainerExtensions()
protected function getContainerExtensions(): array
{
return [new CmfResourceRestExtension()];
}
Expand Down
6 changes: 4 additions & 2 deletions tests/Unit/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase;
use Symfony\Cmf\Bundle\ResourceRestBundle\DependencyInjection\CmfResourceRestExtension;
use Symfony\Cmf\Bundle\ResourceRestBundle\DependencyInjection\Configuration;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;

class ConfigurationTest extends AbstractExtensionConfigurationTestCase
{
protected function getContainerExtension()
protected function getContainerExtension(): ExtensionInterface
{
return new CmfResourceRestExtension();
}

protected function getConfiguration()
protected function getConfiguration(): ConfigurationInterface
{
return new Configuration();
}
Expand Down
9 changes: 5 additions & 4 deletions tests/Unit/Registry/PayloadAliasRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Registry;
namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Unit\Registry;

use PHPUnit\Framework\TestCase;
use Symfony\Cmf\Bundle\ResourceRestBundle\Registry\PayloadAliasRegistry;

class PayloadAliasRegistryTest extends \PHPUnit_Framework_TestCase
class PayloadAliasRegistryTest extends TestCase
{
private $repositoryRegistry;

private $resource;

private $repository;

public function setUp()
public function setUp(): void
{
$this->repositoryRegistry = $this->prophesize('Symfony\Cmf\Component\Resource\RepositoryRegistryInterface');
$this->resource = $this->prophesize('Symfony\Cmf\Component\Resource\Repository\Resource\CmfResource');
Expand Down Expand Up @@ -61,7 +62,7 @@ public function testRegistry($aliases, $resource, $expectedAlias)
$this->resource->getRepository()->willReturn($this->repository);

$alias = $registry->getPayloadAlias($this->resource->reveal());
$this->assertEquals($expectedAlias, $alias);
self::assertEquals($expectedAlias, $alias);
}

private function createRegistry($aliases)
Expand Down
12 changes: 7 additions & 5 deletions tests/Unit/Security/ResourcePathVoterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Security;
namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Unit\Security;

use PHPUnit\Framework\TestCase;
use stdClass;
use Symfony\Cmf\Bundle\ResourceRestBundle\Security\ResourcePathVoter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter as V;

class ResourcePathVoterTest extends \PHPUnit_Framework_TestCase
class ResourcePathVoterTest extends TestCase
{
private $accessDecisionManager;

protected function setUp()
protected function setUp(): void
{
$this->accessDecisionManager = $this->prophesize(AccessDecisionManagerInterface::class);
}
Expand All @@ -37,7 +39,7 @@ public function testVote($rules, $subject, array $attributes, $result)

$voter = new ResourcePathVoter($this->accessDecisionManager->reveal(), $rules);

$this->assertSame($result, $voter->vote($token, $subject, $attributes));
self::assertSame($result, $voter->vote($token, $subject, $attributes));
}

public function provideVoteData()
Expand All @@ -61,7 +63,7 @@ public function provideVoteData()
// Unsupported attributes or subjects
[[], $this->buildSubject('/cms/articles'), ['CMF_RESOURCE_READ'], V::ACCESS_DENIED],
[[$this->buildRule('^/')], $this->buildSubject('/cms/articles'), ['ROLE_USER'], V::ACCESS_ABSTAIN],
[[$this->buildRule('^/')], new \stdClass(), ['CMF_RESOURCE_READ'], V::ACCESS_ABSTAIN],
[[$this->buildRule('^/')], new stdClass(), ['CMF_RESOURCE_READ'], V::ACCESS_ABSTAIN],

// Repository name matching
[[$this->buildRule('^/')], $this->buildSubject('/cms/articles', 'other_repo'), ['CMF_RESOURCE_READ'], V::ACCESS_DENIED],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Serializer\Jms\EventSubscriber;
namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Unit\Serializer\Jms\EventSubscriber;

use PHPUnit\Framework\TestCase;
use Symfony\Cmf\Bundle\ResourceRestBundle\Serializer\Jms\EventSubscriber\PhpcrNodeSubscriber;

class PhpcrNodeSubscriberTest extends \PHPUnit_Framework_TestCase
class PhpcrNodeSubscriberTest extends TestCase
{
private $node;

private $event;

private $subscriber;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
7 changes: 4 additions & 3 deletions tests/Unit/Serializer/Jms/Handler/PhpcrNodeHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Serializer\Handler;
namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Unit\Serializer\Jms\Handler;

use PHPUnit\Framework\TestCase;
use Symfony\Cmf\Bundle\ResourceRestBundle\Serializer\Jms\Handler\PhpcrNodeHandler;

class PhpcrNodeHandlerTest extends \PHPUnit_Framework_TestCase
class PhpcrNodeHandlerTest extends TestCase
{
private $handler;

private $property1;

private $property2;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
7 changes: 4 additions & 3 deletions tests/Unit/Serializer/Jms/Handler/ResourceHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Serializer\Handler;
namespace Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Unit\Serializer\Jms\Handler;

use JMS\Serializer\Context;
use JMS\Serializer\JsonSerializationVisitor;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Symfony\Cmf\Bundle\ResourceRestBundle\Registry\PayloadAliasRegistry;
use Symfony\Cmf\Bundle\ResourceRestBundle\Serializer\Jms\Handler\ResourceHandler;
Expand All @@ -22,7 +23,7 @@
use Symfony\Cmf\Component\Resource\Repository\Resource\CmfResource;
use Symfony\Cmf\Component\Resource\RepositoryRegistryInterface;

class ResourceHandlerTest extends \PHPUnit_Framework_TestCase
class ResourceHandlerTest extends TestCase
{
private $repositoryRegistry;

Expand All @@ -44,7 +45,7 @@ class ResourceHandlerTest extends \PHPUnit_Framework_TestCase

private $description;

protected function setUp()
protected function setUp(): void
{
$this->repositoryRegistry = $this->prophesize(RepositoryRegistryInterface::class);
$this->payloadAliasRegistry = $this->prophesize(PayloadAliasRegistry::class);
Expand Down

0 comments on commit 29705ed

Please sign in to comment.