Skip to content

Commit

Permalink
minor #142 Add support for PHP 8 (pamil)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.9-dev branch.

Discussion
----------



Commits
-------

84fb85c Add support for PHP 8
  • Loading branch information
pamil authored Mar 19, 2021
2 parents 17f93bf + 84fb85c commit 10f2fbb
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.4]
php: [7.4, 8.0]
symfony: [^4.4, ^5.2]

include:
Expand Down Expand Up @@ -47,13 +47,13 @@ jobs:
name: Require sylius/currency-bundle
if: matrix.currency-bundle != ''
run: |
composer require "sylius/currency-bundle:${{ matrix.currency-bundle }}"
composer require "sylius/currency-bundle:${{ matrix.currency-bundle }}" --no-update --no-scripts
-
name: Install dependencies
run: |
composer update ${{ matrix.composer-flags }} --no-scripts
(cd src/Component && composer update ${{ matrix.composer-flags }} --no-scripts)
composer update ${{ matrix.php == '8.0' && '--ignore-platform-req=php' || '' }} --no-scripts
(cd src/Component && composer update ${{ matrix.php == '8.0' && '--ignore-platform-req=php' || '' }} --no-scripts)
-
name: Prepare test application
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
],
"require": {
"php": "^7.4",
"php": "^7.4 || ^8.0",
"sylius-labs/polyfill-symfony-event-dispatcher": "^1.0",
"sylius/registry": "^1.5",
"symfony/config": "^4.4 || ^5.2",
Expand Down Expand Up @@ -65,7 +65,7 @@
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"sylius-labs/coding-standard": "^3.0",
"sylius/resource-bundle": "^1.7",
"sylius/resource-bundle": "^1.8",
"symfony/console": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
"symfony/polyfill-mbstring": "<1.22.0 || >1.22.0",
Expand Down
2 changes: 2 additions & 0 deletions phpspec.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ suites:

extensions:
Akeneo\SkipExampleExtension: ~

bootstrap: phpspec/bootstrap.php
6 changes: 6 additions & 0 deletions phpspec/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

require_once __DIR__ . '/../vendor/autoload.php';

// TODO: To ignore \E_USER_DEPRECATED errors for now
error_reporting(0);
26 changes: 21 additions & 5 deletions src/Bundle/spec/Doctrine/PHPCRODM/DataSourceSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,26 @@
*/
final class DataSourceSpec extends ObjectBehavior
{
function let(QueryBuilder $queryBuilder, ExpressionBuilderInterface $expressionBuilder): void
function it_implements_data_source(
QueryBuilder $queryBuilder,
ExpressionBuilderInterface $expressionBuilder
): void
{
$this->beConstructedWith($queryBuilder, $expressionBuilder);
}

function it_implements_data_source(): void
{
$this->shouldImplement(DataSourceInterface::class);
}

function it_should_restrict_with_or_condition(
QueryBuilder $queryBuilder,
ExpressionBuilderInterface $expressionBuilder,
Comparison $comparison,
Value $value,
QueryBuilder $queryBuilder,
ConstraintOrx $constraint,
ConstraintComparison $comparisonConstraint
): void {
$this->beConstructedWith($queryBuilder, $expressionBuilder);

$queryBuilder->orWhere()->willReturn($constraint);
$value->getValue()->willReturn('value');
$comparison->getValue()->willReturn($value);
Expand All @@ -65,16 +68,23 @@ function it_should_restrict_with_or_condition(
}

function it_should_throw_an_exception_if_an_unknown_condition_is_passed(
QueryBuilder $queryBuilder,
ExpressionBuilderInterface $expressionBuilder,
Comparison $comparison
): void {
$this->beConstructedWith($queryBuilder, $expressionBuilder);

$this->shouldThrow(
new \RuntimeException('Unknown restrict condition "foo"')
)->during('restrict', [$comparison, 'foo']);
}

function it_should_return_the_expression_builder(
QueryBuilder $queryBuilder,
ExpressionBuilderInterface $expressionBuilder
): void {
$this->beConstructedWith($queryBuilder, $expressionBuilder);

$this->getExpressionBuilder()->shouldReturn($expressionBuilder);
}

Expand All @@ -83,6 +93,8 @@ function it_should_get_the_data(
ExpressionBuilderInterface $expressionBuilder,
Query $query
): void {
$this->beConstructedWith($queryBuilder, $expressionBuilder);

$expressionBuilder->getOrderBys()->willReturn([]);

$queryBuilder->orderBy()->willReturn(null);
Expand All @@ -101,6 +113,8 @@ function it_should_set_the_order_on_the_query_builder(
OrderBy $orderBy,
Ordering $ordering
): void {
$this->beConstructedWith($queryBuilder, $expressionBuilder);

$expressionBuilder->getOrderBys()->willReturn([
'foo' => 'asc',
'bar' => 'desc',
Expand All @@ -126,6 +140,8 @@ function it_should_set_the_order_on_the_query_builder_as_fields_only(
OrderBy $orderBy,
Ordering $ordering
): void {
$this->beConstructedWith($queryBuilder, $expressionBuilder);

$expressionBuilder->getOrderBys()->willReturn([
'foo',
'bar',
Expand Down
2 changes: 1 addition & 1 deletion src/Component/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
],
"require": {
"php": "^7.4",
"php": "^7.4 || ^8.0",
"sylius-labs/polyfill-symfony-event-dispatcher": "^1.0",
"sylius/registry": "^1.5",
"symfony/deprecation-contracts": "^2.2",
Expand Down
2 changes: 2 additions & 0 deletions src/Component/phpspec.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ suites:
namespace: Sylius\Component\Grid
psr4_prefix: Sylius\Component\Grid
src_path: .

bootstrap: phpspec/bootstrap.php
6 changes: 6 additions & 0 deletions src/Component/phpspec/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

require_once __DIR__ . '/../vendor/autoload.php';

// TODO: To ignore \E_USER_DEPRECATED errors for now
error_reporting(0);

0 comments on commit 10f2fbb

Please sign in to comment.