From 2b571051e7049350456610b19416035d45920a4f Mon Sep 17 00:00:00 2001 From: Petro Kurbatskyi <67897517+ibexa-yuna@users.noreply.github.com> Date: Mon, 10 Jan 2022 08:58:56 +0100 Subject: [PATCH 1/6] IBX-1734: Added cross-org merge workflow (#63) --- .github/workflows/cross-merge.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/cross-merge.yaml diff --git a/.github/workflows/cross-merge.yaml b/.github/workflows/cross-merge.yaml new file mode 100644 index 0000000..41c5df1 --- /dev/null +++ b/.github/workflows/cross-merge.yaml @@ -0,0 +1,12 @@ +name: Ibexa Reusable / Cross Org PR + +on: + push: + branches-ignore: + - "temp_*" + +jobs: + call: + uses: ibexa/gh-workflows/.github/workflows/cross-merge.yml@main + secrets: + robot-token: ${{ secrets.EZROBOT_PAT }} From 5d54d233d267e46961c62c0bf1a9f0ca2ac3eb92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 17 Jan 2022 10:54:45 +0100 Subject: [PATCH 2/6] [CI] Moved to Github Actions (#62) * [CI] Moved to Github Actions * [CS] Unified CS configs and fixed codestyle * adjusted composer dependencies and added CI jobs for newer PHP versions Co-authored-by: konradoboza --- .github/workflows/browser-tests.yaml | 19 +++++ .github/workflows/ci.yaml | 73 +++++++++++++++++++ .php_cs | 2 +- .php_cs.spec | 20 ----- .travis.yml | 52 ------------- .travis/prepare_ezplatform.sh | 12 --- composer.json | 15 ++-- .../ExceptionSafeQueryFieldServiceSpec.php | 10 +-- spec/API/QueryFieldServiceSpec.php | 16 ++-- .../ContentQueryFieldDefinitionMapperSpec.php | 16 ++-- spec/GraphQL/QueryFieldResolverSpec.php | 6 +- .../FieldDefinitionIdentifierMatcherSpec.php | 10 +-- .../ContentView/QueryResultsInjectorSpec.php | 20 ++--- .../Converter/QueryConverterSpec.php | 26 +++---- 14 files changed, 154 insertions(+), 143 deletions(-) create mode 100644 .github/workflows/browser-tests.yaml create mode 100644 .github/workflows/ci.yaml delete mode 100644 .php_cs.spec delete mode 100644 .travis.yml delete mode 100755 .travis/prepare_ezplatform.sh diff --git a/.github/workflows/browser-tests.yaml b/.github/workflows/browser-tests.yaml new file mode 100644 index 0000000..31eda94 --- /dev/null +++ b/.github/workflows/browser-tests.yaml @@ -0,0 +1,19 @@ +name: Browser tests + +on: + push: + branches: + - main + - '[0-9]+.[0-9]+' + pull_request: ~ + +jobs: + query-fieldtype: + name: "Page Builder browser tests" + uses: ibexa/gh-workflows/.github/workflows/browser-tests.yml@main + with: + project-edition: 'oss' + project-version: '^3.3.x-dev' + test-suite: '--profile=browser --suite=admin-ui --tags=@contentQuery' + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..23d1ad5 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,73 @@ +name: CI + +on: + push: + branches: + - main + - '[0-9]+.[0-9]+' + pull_request: ~ + +jobs: + cs-fix: + name: Run code style check + runs-on: "ubuntu-20.04" + strategy: + matrix: + php: + - '8.0' + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP Action + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: 'pdo_sqlite, gd' + tools: cs2pr + + - uses: "ramsey/composer-install@v1" + with: + dependency-versions: "highest" + + - name: Run code style check + run: composer run-script check-cs -- --format=checkstyle | cs2pr + + tests: + name: Unit tests + runs-on: "ubuntu-20.04" + timeout-minutes: 15 + + strategy: + fail-fast: false + matrix: + php: + - '7.3' + - '7.4' + - '8.0' + composer-options: [ "" ] + include: + - php: '8.1' + composer-options: "--ignore-platform-req php" + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP Action + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: pdo_sqlite, gd + tools: cs2pr + + - uses: "ramsey/composer-install@v1" + 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: Run unit test suite + run: composer test diff --git a/.php_cs b/.php_cs index da58c97..f6df41c 100644 --- a/.php_cs +++ b/.php_cs @@ -2,6 +2,6 @@ return EzSystems\EzPlatformCodeStyle\PhpCsFixer\EzPlatformInternalConfigFactory::build()->setFinder( PhpCsFixer\Finder::create() - ->in(__DIR__ . '/src') + ->in([__DIR__ . '/src', __DIR__ . '/spec']) ->files()->name('*.php') ); diff --git a/.php_cs.spec b/.php_cs.spec deleted file mode 100644 index c1a176d..0000000 --- a/.php_cs.spec +++ /dev/null @@ -1,20 +0,0 @@ -setRules( - array_merge( - $config->getRules(), - [ - 'visibility_required' => false, - ] - ) - ) - ->setFinder( - PhpCsFixer\Finder::create() - ->in(__DIR__ . '/spec') - ->files()->name('*.php') - ); - -return $config; diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 976c5b3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,52 +0,0 @@ -language: php -php: - - 7.3 - -branches: - only: - - master - - dev - - /^\d.\d+$/ - -cache: - directories: - - $HOME/.composer/cache/files - - -matrix: - include: - - name: "Code Style Check" - env: TARGET="codestyle" - - name: "phpspec on PHP7.3" - php: 7.3 - env: TARGET="phpspec" - - name: "phpspec on PHP7.4" - php: 7.4 - env: TARGET="phpspec" - - name: "Browser tests using Query fieldtype" - php: 7.3 - env: - - TARGET="behat" - - EZPLATFORM_REPO="https://github.com/ezsystems/ezplatform.git" - - COMPOSE_FILE="doc/docker/base-dev.yml:doc/docker/selenium.yml" - - APP_ENV=behat - - APP_DEBUG=1 - - BEHAT_OPTS="--profile=adminui --suite=adminui --tags=@queryFieldType" - -install: - # Disable XDebug for performance - - phpenv config-rm xdebug.ini - - if [ "$TARGET" == "phpspec" ] || [ "$TARGET" == "codestyle" ] ; then COMPOSER_MEMORY_LIMIT=-1 composer install; fi - - if [ "$TARGET" == "behat" ] ; then ./.travis/prepare_ezplatform.sh; fi - -script: - - if [ "$TARGET" == "phpspec" ] ; then ./vendor/bin/phpspec run --format=pretty; fi - - if [ "$TARGET" == "codestyle" ] ; then ./vendor/bin/php-cs-fixer fix --dry-run -v --show-progress=estimating && ./vendor/bin/php-cs-fixer fix --config=.php_cs.spec --dry-run -v --show-progress=estimating; fi - -notifications: - slack: - rooms: - - secure: hviD7OAoMq5ZH9/4SPwBFoUsx8sO5KuZi3sPz5chpAhz0sHnBLyxvLzSvudKRtqNoMcS/+f/EaNvW2r3yLfQyd+QH9DUAqHoflQrMQnOQWf4CfXfjszTfKMSfU8zBclV+4/Zgs2fs1iDsKzEXF8FY21sElwahB0/ktVHjBiVaLZz6XwetiWYpxwjkKi+bsL80ytstmD8U5BXyywLZsTq+E5Gh5HtxOMtbfh4AITE4nOnWNLikwRMfxl44mAK8D7GOFe/tvxFaysojvggDoS+5LJyDbnKv74/yc2RzWz6cPuEzGn/8xArhfoWx/UwPbedlP8wPZfnOpSEF8+g4Kt3V0/bpNMPU7TrOOrLnIg5os0gsW2HJhFDLIR4qXMq3LLWURNmlgsXWlGm75mHDpusdRBrCHfDbORf+5TMPoop20YEqHPCxhl941pjAX2JGj3PzBb6eWmzEJO9Vh+861MhDv0Lz/rRw9Kq/bMQc0mLZ2O8L74iXrHeTloUDH2yStUf1eE+0aonIEqF/mxAKl8wBrk/E2OE25Udkj8qExI67c1ldn1QWBa8Q3AhrsThwCOpXD6VDjB3dP6A98JedR94dpbe2w0f8HaXqPFMZe/YovGptfg6CrPMwgKYf++yTHiWBd0khh0CEd1FT1wqeT+VlZZmmTH+nqsIi2CXmnk6cVE= - on_success: change - on_failure: always - on_pull_requests: false diff --git a/.travis/prepare_ezplatform.sh b/.travis/prepare_ezplatform.sh deleted file mode 100755 index 18c6bcc..0000000 --- a/.travis/prepare_ezplatform.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -EZPLATFORM_BRANCH=`php -r 'echo json_decode(file_get_contents("./composer.json"))->extra->_ezplatform_branch_for_behat_tests;'` -EZPLATFORM_BRANCH="${EZPLATFORM_BRANCH:-master}" -PACKAGE_BUILD_DIR=$PWD -EZPLATFORM_BUILD_DIR=${HOME}/build/ezplatform - -echo "> Cloning ezsystems/ezplatform:${EZPLATFORM_BRANCH}" -git clone --depth 1 --single-branch --branch "${EZPLATFORM_BRANCH}" ${EZPLATFORM_REPO} ${EZPLATFORM_BUILD_DIR} -cd ${EZPLATFORM_BUILD_DIR} - -/bin/bash ./bin/.travis/trusty/setup_ezplatform.sh "${COMPOSE_FILE}" '' "${PACKAGE_BUILD_DIR}" diff --git a/composer.json b/composer.json index 40ec972..13040ad 100644 --- a/composer.json +++ b/composer.json @@ -36,25 +36,28 @@ } }, "require-dev": { + "ezsystems/ezplatform-core": "^2.3@dev", "ezsystems/doctrine-dbal-schema": "^1.0@dev", "ezsystems/ez-support-tools": "^2.0@dev", "ezsystems/ezplatform-design-engine": "^3.0@dev", + "ezsystems/ezplatform-http-cache": "^2.3@dev", "ezsystems/ezplatform-richtext": "^2.0@dev", "ezsystems/ezplatform-search": "^1.0@dev", "ezsystems/ezplatform-user": "^2.0@dev", - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^7.1", "ezsystems/ezplatform-code-style": "^0.1.0", - "friendsofphp/php-cs-fixer": "^2.16.0" + "friendsofphp/php-cs-fixer": "^2.16.0", + "ibexa/ci-scripts": "^0.1@dev" }, "scripts": { - "fix-cs": [ - "php-cs-fixer --ansi fix -v --show-progress=estimating", - "php-cs-fixer --ansi fix --config=.php_cs.spec -v --show-progress=estimating" - ] + "fix-cs": "php-cs-fixer --ansi fix -v --show-progress=estimating", + "check-cs": "@fix-cs --dry-run", + "test": "phpspec run --format=pretty" }, "extra": { "_ezplatform_branch_for_behat_tests": "master", "branch-alias": { + "dev-master": "2.3.x-dev", "dev-tmp_ci_branch": "2.3.x-dev", "dev-2.1": "2.3.x-dev" } diff --git a/spec/API/ExceptionSafeQueryFieldServiceSpec.php b/spec/API/ExceptionSafeQueryFieldServiceSpec.php index fdce568..f3a132a 100644 --- a/spec/API/ExceptionSafeQueryFieldServiceSpec.php +++ b/spec/API/ExceptionSafeQueryFieldServiceSpec.php @@ -14,7 +14,7 @@ class ExceptionSafeQueryFieldServiceSpec extends ObjectBehavior { - function let(QueryFieldServiceInterface $queryFieldService) + public function let(QueryFieldServiceInterface $queryFieldService) { $arguments = [ Argument::type(Content::class), @@ -30,24 +30,24 @@ function let(QueryFieldServiceInterface $queryFieldService) $this->beConstructedWith($queryFieldService); } - function it_is_initializable() + public function it_is_initializable() { $this->shouldHaveType(ExceptionSafeQueryFieldService::class); } - function it_should_return_empty_results_on_count_content_items() + public function it_should_return_empty_results_on_count_content_items() { $result = $this->countContentItems(new Content([]), 'any'); $result->shouldBe(0); } - function it_should_return_empty_results_on_load_content_items() + public function it_should_return_empty_results_on_load_content_items() { $result = $this->loadContentItems(new Content([]), 'any'); $result->shouldBe([]); } - function it_should_return_empty_results_on_load_content_items_slice() + public function it_should_return_empty_results_on_load_content_items_slice() { $result = $this->loadContentItemsSlice(new Content([]), 'any', 0, 5); $result->shouldBe([]); diff --git a/spec/API/QueryFieldServiceSpec.php b/spec/API/QueryFieldServiceSpec.php index 858efd8..2064cb8 100644 --- a/spec/API/QueryFieldServiceSpec.php +++ b/spec/API/QueryFieldServiceSpec.php @@ -32,7 +32,7 @@ class QueryFieldServiceSpec extends ObjectBehavior private $searchHits; private $totalCount = 0; - function let( + public function let( SearchService $searchService, ContentTypeService $contentTypeService, LocationService $locationService, @@ -65,22 +65,22 @@ function let( $this->beConstructedWith($searchService, $contentTypeService, $locationService, $queryTypeRegistry); } - function it_is_initializable() + public function it_is_initializable() { $this->shouldHaveType(QueryFieldService::class); } - function it_loads_items_from_a_query_field_for_a_given_content_item() + public function it_loads_items_from_a_query_field_for_a_given_content_item() { $this->loadContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe($this->searchHits); } - function it_counts_items_from_a_query_field_for_a_given_content_item() + public function it_counts_items_from_a_query_field_for_a_given_content_item() { $this->countContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe($this->totalCount); } - function it_deducts_any_offset_when_counting_results(QueryType $queryType, SearchService $searchService) + public function it_deducts_any_offset_when_counting_results(QueryType $queryType, SearchService $searchService) { $query = new ApiContentQuery(); $query->offset = 5; @@ -93,7 +93,7 @@ function it_deducts_any_offset_when_counting_results(QueryType $queryType, Searc $this->countContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe(2); } - function it_returns_zero_if_offset_is_bigger_than_count(QueryType $queryType, SearchService $searchService) + public function it_returns_zero_if_offset_is_bigger_than_count(QueryType $queryType, SearchService $searchService) { $query = new ApiContentQuery(); $query->offset = 8; @@ -106,7 +106,7 @@ function it_returns_zero_if_offset_is_bigger_than_count(QueryType $queryType, Se $this->countContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe(0); } - function it_returns_0_as_pagination_configuration_if_pagination_is_disabled() + public function it_returns_0_as_pagination_configuration_if_pagination_is_disabled() { $this->getPaginationConfiguration( $this->getContent(self::CONTENT_TYPE_ID_WITHOUT_PAGINATION), @@ -114,7 +114,7 @@ function it_returns_0_as_pagination_configuration_if_pagination_is_disabled() )->shouldBe(0); } - function it_returns_the_items_per_page_number_as_pagination_configuration_if_pagination_is_enabled() + public function it_returns_the_items_per_page_number_as_pagination_configuration_if_pagination_is_enabled() { $this->getPaginationConfiguration( $this->getContent(), diff --git a/spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php b/spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php index 72bc2e7..f1b7100 100644 --- a/spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php +++ b/spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php @@ -21,7 +21,7 @@ class ContentQueryFieldDefinitionMapperSpec extends ObjectBehavior const RETURNED_CONTENT_TYPE_IDENTIFIER = 'folder'; const GRAPHQL_TYPE = 'FolderContent'; - function let( + public function let( FieldDefinitionMapper $innerMapper, NameHelper $nameHelper, ContentTypeService $contentTypeService @@ -39,13 +39,13 @@ function let( $this->beConstructedWith($innerMapper, $nameHelper, $contentTypeService, self::FIELD_TYPE_IDENTIFIER); } - function it_is_initializable() + public function it_is_initializable() { $this->shouldHaveType(ContentQueryFieldDefinitionMapper::class); $this->shouldHaveType(FieldDefinitionMapper::class); } - function it_returns_as_value_type_the_configured_ContentType_for_query_field_definitions(FieldDefinitionMapper $innerMapper) + public function it_returns_as_value_type_the_configured_ContentType_for_query_field_definitions(FieldDefinitionMapper $innerMapper) { $fieldDefinition = $this->fieldDefinition(); $innerMapper->mapToFieldValueType($fieldDefinition)->shouldNotBeCalled(); @@ -54,7 +54,7 @@ function it_returns_as_value_type_the_configured_ContentType_for_query_field_def ->shouldBe('[' . self::GRAPHQL_TYPE . ']'); } - function it_delegates_value_type_to_the_inner_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper) + public function it_delegates_value_type_to_the_inner_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper) { $fieldDefinition = $this->getLambdaFieldDefinition(); $innerMapper->mapToFieldValueType($fieldDefinition)->willReturn('SomeType'); @@ -63,7 +63,7 @@ function it_delegates_value_type_to_the_inner_mapper_for_a_non_query_field_defin ->shouldBe('SomeType'); } - function it_returns_the_correct_field_definition_GraphQL_type(FieldDefinitionMapper $innerMapper) + public function it_returns_the_correct_field_definition_GraphQL_type(FieldDefinitionMapper $innerMapper) { $fieldDefinition = $this->fieldDefinition(); $innerMapper->mapToFieldDefinitionType($fieldDefinition)->shouldNotBeCalled(); @@ -72,7 +72,7 @@ function it_returns_the_correct_field_definition_GraphQL_type(FieldDefinitionMap ->shouldBe('ContentQueryFieldDefinition'); } - function it_delegates_field_definition_type_to_the_parent_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper) + public function it_delegates_field_definition_type_to_the_parent_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper) { $fieldDefinition = $this->getLambdaFieldDefinition(); $innerMapper->mapToFieldDefinitionType($fieldDefinition)->willReturn('FieldValue'); @@ -81,7 +81,7 @@ function it_delegates_field_definition_type_to_the_parent_mapper_for_a_non_query ->shouldBe('FieldValue'); } - function it_maps_the_field_value_when_pagination_is_disabled(FieldDefinitionMapper $innerMapper) + public function it_maps_the_field_value_when_pagination_is_disabled(FieldDefinitionMapper $innerMapper) { $fieldDefinition = $this->fieldDefinition(); $innerMapper->mapToFieldValueResolver($fieldDefinition)->shouldNotBeCalled(); @@ -90,7 +90,7 @@ function it_maps_the_field_value_when_pagination_is_disabled(FieldDefinitionMapp ->shouldBe('@=resolver("QueryFieldValue", [field, content])'); } - function it_maps_the_field_value_when_pagination_is_enabled(FieldDefinitionMapper $innerMapper) + public function it_maps_the_field_value_when_pagination_is_enabled(FieldDefinitionMapper $innerMapper) { $fieldDefinition = $this->fieldDefinition(true); $innerMapper->mapToFieldValueResolver($fieldDefinition)->shouldNotBeCalled(); diff --git a/spec/GraphQL/QueryFieldResolverSpec.php b/spec/GraphQL/QueryFieldResolverSpec.php index b8ac7f1..75fda61 100644 --- a/spec/GraphQL/QueryFieldResolverSpec.php +++ b/spec/GraphQL/QueryFieldResolverSpec.php @@ -16,17 +16,17 @@ class QueryFieldResolverSpec extends ObjectBehavior { const FIELD_DEFINITION_IDENTIFIER = 'test'; - function let(QueryFieldServiceInterface $queryFieldService) + public function let(QueryFieldServiceInterface $queryFieldService) { $this->beConstructedWith($queryFieldService); } - function it_is_initializable() + public function it_is_initializable() { $this->shouldHaveType(QueryFieldResolver::class); } - function it_resolves_a_query_field(QueryFieldServiceInterface $queryFieldService) + public function it_resolves_a_query_field(QueryFieldServiceInterface $queryFieldService) { $content = new Content(); $field = new Field(['fieldDefIdentifier' => self::FIELD_DEFINITION_IDENTIFIER, 'value' => new \stdClass()]); diff --git a/spec/eZ/ContentView/FieldDefinitionIdentifierMatcherSpec.php b/spec/eZ/ContentView/FieldDefinitionIdentifierMatcherSpec.php index 9e4a80d..0dfb070 100644 --- a/spec/eZ/ContentView/FieldDefinitionIdentifierMatcherSpec.php +++ b/spec/eZ/ContentView/FieldDefinitionIdentifierMatcherSpec.php @@ -29,13 +29,13 @@ class FieldDefinitionIdentifierMatcherSpec extends ObjectBehavior const FIELD_DEFINITION_IDENTIFIER = 'field_definition'; - function it_is_initializable() + public function it_is_initializable() { $this->shouldHaveType(FieldDefinitionIdentifierMatcher::class); $this->shouldHaveType(ViewMatcherInterface::class); } - static function initialize(Repository $repository, array $matchingConfig): FieldDefinitionIdentifierMatcher + public static function initialize(Repository $repository, array $matchingConfig): FieldDefinitionIdentifierMatcher { $matcher = new FieldDefinitionIdentifierMatcher(); $matcher->setRepository($repository); @@ -44,7 +44,7 @@ static function initialize(Repository $repository, array $matchingConfig): Field return $matcher; } - function let(Repository $repository, ContentTypeService $contentTypeService) + public function let(Repository $repository, ContentTypeService $contentTypeService) { $repository->getContentTypeService()->willReturn($contentTypeService); $contentTypeService->loadContentType(self::CONTENT_TYPE_ID_WITHOUT_FIELD_DEFINITION)->willReturn($this->createContentTypeWithoutFieldDefinition()); @@ -52,13 +52,13 @@ function let(Repository $repository, ContentTypeService $contentTypeService) $this->beConstructedThrough([$this, 'initialize'], [$repository, [self::FIELD_DEFINITION_IDENTIFIER]]); } - function it_does_not_match_if_field_definition_identifier_does_not_exist() + public function it_does_not_match_if_field_definition_identifier_does_not_exist() { $view = $this->buildView(self::CONTENT_TYPE_ID_WITHOUT_FIELD_DEFINITION); $this->match($view)->shouldBe(false); } - function it_matches_if_field_definition_identifier_matches() + public function it_matches_if_field_definition_identifier_matches() { $view = $this->buildView(self::CONTENT_TYPE_ID_WITH_FIELD_DEFINITION); $this->match($view)->shouldBe(true); diff --git a/spec/eZ/ContentView/QueryResultsInjectorSpec.php b/spec/eZ/ContentView/QueryResultsInjectorSpec.php index 8139ef7..56b1059 100644 --- a/spec/eZ/ContentView/QueryResultsInjectorSpec.php +++ b/spec/eZ/ContentView/QueryResultsInjectorSpec.php @@ -51,12 +51,12 @@ public function __construct() ); } - function it_is_initializable() + public function it_is_initializable() { $this->shouldHaveType(QueryResultsInjector::class); } - function let( + public function let( QueryFieldServiceInterface $queryFieldService, FilterViewParametersEvent $event, RequestStack $requestStack @@ -72,7 +72,7 @@ function let( ); } - function it_throws_an_InvalidArgumentException_if_no_item_view_is_provided( + public function it_throws_an_InvalidArgumentException_if_no_item_view_is_provided( QueryFieldServiceInterface $queryFieldService, RequestStack $requestStack ) { @@ -80,7 +80,7 @@ function it_throws_an_InvalidArgumentException_if_no_item_view_is_provided( $this->shouldThrow(\InvalidArgumentException::class)->duringInstantiation(); } - function it_throws_an_InvalidArgumentException_if_no_field_view_is_provided( + public function it_throws_an_InvalidArgumentException_if_no_field_view_is_provided( QueryFieldServiceInterface $queryFieldService, RequestStack $requestStack ) { @@ -88,24 +88,24 @@ function it_throws_an_InvalidArgumentException_if_no_field_view_is_provided( $this->shouldThrow(\InvalidArgumentException::class)->duringInstantiation(); } - function it_is_an_event_subscriber() + public function it_is_an_event_subscriber() { $this->shouldHaveType(EventSubscriberInterface::class); } - function it_subscribes_to_the_FILTER_VIEW_PARAMETERS_View_Event() + public function it_subscribes_to_the_FILTER_VIEW_PARAMETERS_View_Event() { $this->getSubscribedEvents()->shouldSubscribeTo(ViewEvents::FILTER_VIEW_PARAMETERS); } - function it_does_nothing_for_non_field_views(QueryFieldServiceInterface $queryFieldService) + public function it_does_nothing_for_non_field_views(QueryFieldServiceInterface $queryFieldService) { $this->event->getView()->setViewType(self::OTHER_VIEW); $this->injectQueryResults($this->event); $queryFieldService->getPaginationConfiguration(Argument::any())->shouldNotHaveBeenCalled(); } - function it_adds_the_query_results_for_the_field_view_without_pagination(QueryFieldServiceInterface $queryFieldService) + public function it_adds_the_query_results_for_the_field_view_without_pagination(QueryFieldServiceInterface $queryFieldService) { $content = $this->createContentItem(); @@ -129,7 +129,7 @@ function it_adds_the_query_results_for_the_field_view_without_pagination(QueryFi Assert::eq($parameters->get('items'), $this->getResults()); } - function it_adds_the_query_results_for_the_field_view_with_pagination( + public function it_adds_the_query_results_for_the_field_view_with_pagination( FilterViewParametersEvent $event, QueryFieldServiceInterface $queryFieldService ) { @@ -157,7 +157,7 @@ function it_adds_the_query_results_for_the_field_view_with_pagination( Assert::isInstanceOf($parameters->get('items'), Pagerfanta::class); } - function getMatchers(): array + public function getMatchers(): array { return [ 'subscribeTo' => function ($return, $event) { diff --git a/spec/eZ/Persistence/Legacy/Content/FieldValue/Converter/QueryConverterSpec.php b/spec/eZ/Persistence/Legacy/Content/FieldValue/Converter/QueryConverterSpec.php index 6ea76cf..ac41516 100644 --- a/spec/eZ/Persistence/Legacy/Content/FieldValue/Converter/QueryConverterSpec.php +++ b/spec/eZ/Persistence/Legacy/Content/FieldValue/Converter/QueryConverterSpec.php @@ -20,12 +20,12 @@ class QueryConverterSpec extends ObjectBehavior const ENABLE_PAGINATION = true; const ITEMS_PER_PAGE = 10; - function it_is_initializable() + public function it_is_initializable() { $this->shouldHaveType(QueryConverter::class); } - function getFieldDefinition(): FieldDefinition + public function getFieldDefinition(): FieldDefinition { $fieldDefinition = new FieldDefinition(); $fieldDefinition->fieldTypeConstraints->fieldSettings = [ @@ -39,7 +39,7 @@ function getFieldDefinition(): FieldDefinition return $fieldDefinition; } - function getStorageDefinition(): StorageFieldDefinition + public function getStorageDefinition(): StorageFieldDefinition { $fieldDefinition = new StorageFieldDefinition(); $fieldDefinition->dataText5 = \json_encode(self::PARAMETERS); @@ -51,70 +51,70 @@ function getStorageDefinition(): StorageFieldDefinition return $fieldDefinition; } - function it_stores_Parameters_in_dataText5_in_json_format() + public function it_stores_Parameters_in_dataText5_in_json_format() { $storageFieldDefinition = new StorageFieldDefinition(); $this->toStorageFieldDefinition($this->getFieldDefinition(), $storageFieldDefinition); Assert::eq($storageFieldDefinition->dataText5, \json_encode(self::PARAMETERS)); } - function it_stores_QueryType_in_dataText1() + public function it_stores_QueryType_in_dataText1() { $storageFieldDefinition = new StorageFieldDefinition(); $this->toStorageFieldDefinition($this->getFieldDefinition(), $storageFieldDefinition); Assert::eq($storageFieldDefinition->dataText1, self::QUERY_TYPE); } - function it_stores_ReturnedType_in_dataText2() + public function it_stores_ReturnedType_in_dataText2() { $storageFieldDefinition = new StorageFieldDefinition(); $this->toStorageFieldDefinition($this->getFieldDefinition(), $storageFieldDefinition); Assert::eq($storageFieldDefinition->dataText2, self::RETURNED_TYPE); } - function it_stores_EnablePagination_in_dataInt1() + public function it_stores_EnablePagination_in_dataInt1() { $storageFieldDefinition = new StorageFieldDefinition(); $this->toStorageFieldDefinition($this->getFieldDefinition(), $storageFieldDefinition); Assert::eq($storageFieldDefinition->dataInt1, self::ENABLE_PAGINATION); } - function it_stores_ItemsPerPage_in_dataInt2() + public function it_stores_ItemsPerPage_in_dataInt2() { $storageFieldDefinition = new StorageFieldDefinition(); $this->toStorageFieldDefinition($this->getFieldDefinition(), $storageFieldDefinition); Assert::eq($storageFieldDefinition->dataInt2, self::ITEMS_PER_PAGE); } - function it_reads_Parameters_from_dataText5_in_json_format() + public function it_reads_Parameters_from_dataText5_in_json_format() { $storageFieldDefinition = new StorageFieldDefinition(); $this->toStorageFieldDefinition($this->getFieldDefinition(), $storageFieldDefinition); Assert::eq($storageFieldDefinition->dataText5, \json_encode(self::PARAMETERS)); } - function it_reads_QueryType_from_dataText1() + public function it_reads_QueryType_from_dataText1() { $storageFieldDefinition = new StorageFieldDefinition(); $this->toStorageFieldDefinition($this->getFieldDefinition(), $storageFieldDefinition); Assert::eq($storageFieldDefinition->dataText1, self::QUERY_TYPE); } - function it_reads_ReturnedType_from_dataText2() + public function it_reads_ReturnedType_from_dataText2() { $storageFieldDefinition = new StorageFieldDefinition(); $this->toStorageFieldDefinition($this->getFieldDefinition(), $storageFieldDefinition); Assert::eq($storageFieldDefinition->dataText2, self::RETURNED_TYPE); } - function it_reads_EnablePagination_from_dataInt1() + public function it_reads_EnablePagination_from_dataInt1() { $storageFieldDefinition = new StorageFieldDefinition(); $this->toStorageFieldDefinition($this->getFieldDefinition(), $storageFieldDefinition); Assert::eq($storageFieldDefinition->dataInt1, self::ENABLE_PAGINATION); } - function it_reads_ItemsPerPage_from_dataInt2() + public function it_reads_ItemsPerPage_from_dataInt2() { $storageFieldDefinition = new StorageFieldDefinition(); $this->toStorageFieldDefinition($this->getFieldDefinition(), $storageFieldDefinition); From b69dd49d8bb4070ba152443d3aea41f9fb8a3ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 17 Jan 2022 13:01:19 +0100 Subject: [PATCH 3/6] [CI] Unified CS-fixer config --- .php-cs-fixer-spec.php | 29 ----------------------------- .php-cs-fixer.php | 1 + composer.json | 12 ++++++++---- 3 files changed, 9 insertions(+), 33 deletions(-) delete mode 100644 .php-cs-fixer-spec.php diff --git a/.php-cs-fixer-spec.php b/.php-cs-fixer-spec.php deleted file mode 100644 index 5c28229..0000000 --- a/.php-cs-fixer-spec.php +++ /dev/null @@ -1,29 +0,0 @@ -withRules([ - 'declare_strict_types' => false, - 'visibility_required' => false, -]); - -return $configFactory - ->buildConfig() - ->setFinder( - PhpCsFixer\Finder::create() - ->in( - array_filter([ - __DIR__ . '/spec', - ], 'is_dir') - ) - ->files()->name('*.php') - ); - -return $config; diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index da33ee0..75f6977 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -21,6 +21,7 @@ array_filter([ __DIR__ . '/src', __DIR__ . '/tests', + __DIR__ . '/spec', ], 'is_dir') ) ->files()->name('*.php') diff --git a/composer.json b/composer.json index fa80eab..a2067bc 100644 --- a/composer.json +++ b/composer.json @@ -59,14 +59,18 @@ "friendsofphp/php-cs-fixer": "^3.0" }, "scripts": { - "fix-cs": [ - "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots", - "php-cs-fixer --ansi fix --config=.php-cs-fixer-spec.php -v --show-progress=dots" - ] + "fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots", + "check-cs": "@fix-cs --dry-run", + "test": "phpspec run --format=pretty" }, "extra": { "branch-alias": { "dev-main": "4.0.x-dev" } + }, + "config": { + "allow-plugins": { + "composer/package-versions-deprecated": true + } } } From 3b6a2522544ceb4b135543b8f0c5eeeaff480985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 17 Jan 2022 13:01:47 +0100 Subject: [PATCH 4/6] [CI] Removed testing on PHP 7.3 --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 23d1ad5..4fd01ab 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,7 +42,6 @@ jobs: fail-fast: false matrix: php: - - '7.3' - '7.4' - '8.0' composer-options: [ "" ] From 81b4ad05de05db5462e838a45dd2b5aa977f309d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 17 Jan 2022 13:02:03 +0100 Subject: [PATCH 5/6] [CI] Run browser tests on v4 --- .github/workflows/browser-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/browser-tests.yaml b/.github/workflows/browser-tests.yaml index 31eda94..ab05bb7 100644 --- a/.github/workflows/browser-tests.yaml +++ b/.github/workflows/browser-tests.yaml @@ -13,7 +13,7 @@ jobs: uses: ibexa/gh-workflows/.github/workflows/browser-tests.yml@main with: project-edition: 'oss' - project-version: '^3.3.x-dev' + project-version: '^4.0.x-dev' test-suite: '--profile=browser --suite=admin-ui --tags=@contentQuery' secrets: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} From 8833273aabdedf40e4a43c91e085e173f7efce5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 17 Jan 2022 13:03:51 +0100 Subject: [PATCH 6/6] [CI] Bumped PHPSpec version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a2067bc..26e7725 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,7 @@ "ibexa/search": "^4.0@dev", "ibexa/user": "^4.0@dev", "ibexa/http-cache": "^4.0@dev", - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^7.1", "ibexa/code-style": "^1.0", "friendsofphp/php-cs-fixer": "^3.0" },