Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 25 additions & 32 deletions .github/workflows/backend-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@ jobs:
php:
- '8.1'
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- name: Setup PHP Action
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: 'pdo_sqlite, gd'
tools: cs2pr
- uses: ibexa/gh-workflows/actions/composer-install@main
with:
gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }}
gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }}
satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }}
satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }}

- uses: ramsey/composer-install@v3
with:
dependency-versions: "highest"
- uses: ramsey/composer-install@v3
with:
dependency-versions: highest

Comment thread
konradoboza marked this conversation as resolved.
- name: Run code style check
run: composer run-script check-cs -- --format=checkstyle | cs2pr
- name: Run code style check
run: composer run-script check-cs -- --format=checkstyle | cs2pr

tests:
name: Unit tests
Expand All @@ -46,26 +45,20 @@ jobs:
- '8.3'
- '8.4'
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- name: Setup PHP Action
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: pdo_sqlite, gd
tools: cs2pr
- uses: ibexa/gh-workflows/actions/composer-install@main
with:
gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }}
gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }}
satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }}
satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }}

- uses: ramsey/composer-install@v3
with:
dependency-versions: "highest"
composer-options: "${{ matrix.composer-options }}"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run PHPStan analysis
run: composer run-script phpstan

- name: Run unit test suite
run: composer test

- name: Run PHPStan analysis
run: composer run-script phpstan
- name: Run test suite
run: composer run-script --timeout=600 test
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
},
"config": {
"sort-packages": true,
"allow-plugins": false
"allow-plugins": false,
"audit": {
"ignore": {
"PKSA-7h5p-prw9-w5nr": "The affected version of 3rd party component is installed on PHP 7.4. There's no alternative supporting PHP 7.4. Consider upgrading to PHP 8"
}
}
}
}
7 changes: 7 additions & 0 deletions phpstan-baseline-7.4.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
ignoreErrors:
-
message: '#^PHPDoc tag @return contains generic type Overblog\\GraphQLBundle\\Relay\\Connection\\Output\\Connection\<Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Content\> but class Overblog\\GraphQLBundle\\Relay\\Connection\\Output\\Connection is not generic\.$#'
identifier: generics.notGeneric
count: 1
path: src/lib/GraphQL/QueryFieldResolver.php
17 changes: 17 additions & 0 deletions phpstan-baseline.neon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

$includes = [];
if (PHP_VERSION_ID < 80000) {
$includes[] = __DIR__ . '/phpstan-baseline-7.4.neon';
}

$config = [];
$config['includes'] = $includes;

return $config;
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
includes:
- phpstan-baseline.neon
- phpstan-baseline.neon.php
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/ibexa/phpstan/extension.neon
Expand Down
4 changes: 2 additions & 2 deletions spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function it_maps_the_field_value_when_pagination_is_disabled(FieldDefinit
$innerMapper->mapToFieldValueResolver($fieldDefinition)->shouldNotBeCalled();
$this
->mapToFieldValueResolver($fieldDefinition)
->shouldBe('@=resolver("QueryFieldValue", [field, content])');
->shouldBe('@=query("QueryFieldValue", field, content)');
}

public function it_maps_the_field_value_when_pagination_is_enabled(FieldDefinitionMapper $innerMapper)
Expand All @@ -97,7 +97,7 @@ public function it_maps_the_field_value_when_pagination_is_enabled(FieldDefiniti
$innerMapper->mapToFieldValueResolver($fieldDefinition)->shouldNotBeCalled();
$this
->mapToFieldValueResolver($fieldDefinition)
->shouldBe('@=resolver("QueryFieldValueConnection", [args, field, content])');
->shouldBe('@=query("QueryFieldValueConnection", args, field, content)');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ContentQueryFieldSettings:
parameters:
type: "[ContentQueryFieldParameter]"
description: "Parameters used to generate the Query from the Query type"
resolve: "@=resolver('QueryFieldDefinitionParameters', [value['Parameters']])"
resolve: "@=query('QueryFieldDefinitionParameters', value['Parameters'])"
returnedType:
type: ContentType
description: "Content type returned by the field"
Expand Down
6 changes: 3 additions & 3 deletions src/bundle/Resources/config/services/graphql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ services:

Ibexa\FieldTypeQuery\GraphQL\QueryFieldResolver:
tags:
- { name: overblog_graphql.resolver, alias: "QueryFieldValue", method: "resolveQueryField" }
- { name: overblog_graphql.resolver, alias: "QueryFieldValueConnection", method: "resolveQueryFieldConnection" }
- { name: overblog_graphql.resolver, alias: "QueryFieldDefinitionParameters", method: "resolveQueryFieldDefinitionParameters" }
- { name: overblog_graphql.query, alias: "QueryFieldValue", method: "resolveQueryField" }
- { name: overblog_graphql.query, alias: "QueryFieldValueConnection", method: "resolveQueryFieldConnection" }
- { name: overblog_graphql.query, alias: "QueryFieldDefinitionParameters", method: "resolveQueryFieldDefinitionParameters" }


Ibexa\FieldTypeQuery\GraphQL\ContentQueryFieldDefinitionMapper:
Expand Down
4 changes: 2 additions & 2 deletions src/lib/GraphQL/ContentQueryFieldDefinitionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public function mapToFieldValueResolver(FieldDefinition $fieldDefinition): ?stri
$fieldSettings = $fieldDefinition->getFieldSettings();

if ($fieldSettings['EnablePagination']) {
return '@=resolver("QueryFieldValueConnection", [args, field, content])';
return '@=query("QueryFieldValueConnection", args, field, content)';
} else {
return '@=resolver("QueryFieldValue", [field, content])';
return '@=query("QueryFieldValue", field, content)';
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/GraphQL/QueryFieldResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function resolveQueryField(Field $field, Content $content): iterable
}

/**
* @return \GraphQL\Executor\Promise\Promise|\Overblog\GraphQLBundle\Relay\Connection\Output\Connection|null
* @return \GraphQL\Executor\Promise\Promise|\Overblog\GraphQLBundle\Relay\Connection\Output\Connection<\Ibexa\Contracts\Core\Repository\Values\Content\Content>|null
*/
public function resolveQueryFieldConnection(Argument $args, ?Field $field, Content $content)
{
Expand Down
Loading