diff --git a/.github/workflows/api_tests.yaml b/.github/workflows/api_tests.yaml index 89d7658ec..a5d21e878 100644 --- a/.github/workflows/api_tests.yaml +++ b/.github/workflows/api_tests.yaml @@ -8,8 +8,25 @@ jobs: strategy: matrix: php-version: [ '8.1', '8.2', '8.3', '8.4' ] + database: + - 'sqlite:///%kernel.project_dir%/var/data/bolt.sqlite' + - 'mysql://bolt:bolt@127.0.0.1/bolt?serverVersion=5.7&charset=utf8mb4' name: curl tests + services: + mysql: + image: mysql:5.7 + ports: + - "3306:3306" + env: + MYSQL_DATABASE: bolt + MYSQL_USER: bolt + MYSQL_PASSWORD: bolt + MYSQL_ROOT_PASSWORD: bolt + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + runs-on: ubuntu-latest + env: + DATABASE_URL: ${{matrix.database}} steps: - uses: actions/checkout@v4 - uses: shivammathur/setup-php@v2 @@ -23,12 +40,15 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install composer dependencies run: composer install --prefer-dist --no-progress + - name: Initialise folders + run: sudo chmod -R 777 config/ public/files/ public/theme/ public/thumbs/ var/ + - name: create the database + run: ./bin/console doctrine:database:create + if: ${{ startsWith('sqlite', matrix.database) }} - name: Initialise the database - run: | - sudo chmod -R 777 config/ public/files/ public/theme/ public/thumbs/ var/ - ./bin/console doctrine:database:create - ./bin/console doctrine:schema:create - symfony server:start --no-tls --port=8088 -d + run: ./bin/console doctrine:schema:create + - name: Starting server + run: symfony server:start --no-tls --port=8088 -d - name: create api user run: php bin/console bolt:add-user apiuser apiuser%1 api@example.org API --roles=ROLE_WEBSERVICE - name: check API user gets content diff --git a/composer.json b/composer.json index 4cb2e4c9d..cf0edab74 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "doctrine/doctrine-bundle": "^2.4", "doctrine/doctrine-fixtures-bundle": "^3.4", "doctrine/doctrine-migrations-bundle": "^3.2", + "doctrine/lexer": "^2 || ^3", "doctrine/orm": "^2.10", "drupol/composer-packages": "^2.0", "embed/embed": "^3.4", @@ -97,7 +98,6 @@ "bobdenotter/configuration-notices": "^1.2", "bobdenotter/weatherwidget": "^1.1", "bolt/newswidget": "^1.3", - "coduo/php-matcher": "^5.0", "dama/doctrine-test-bundle": "^6.6.0", "nyholm/psr7": "^1.4", "ondram/ci-detector": "^4.1", diff --git a/src/Api/Extensions/ContentExtension.php b/src/Api/Extensions/ContentExtension.php index abb51291b..386c31000 100644 --- a/src/Api/Extensions/ContentExtension.php +++ b/src/Api/Extensions/ContentExtension.php @@ -34,8 +34,12 @@ public function __construct(Config $config) })->values(); } - public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?string $operationName = null): void - { + public function applyToCollection( + QueryBuilder $queryBuilder, + QueryNameGeneratorInterface $queryNameGenerator, + string $resourceClass, + ?string $operationName = null + ): void { /* * Note: We're not distinguishing between `viewless` and `viewless_listing` here. In the * context of the API it makes no sense to say "You can get a list, but not the details" @@ -51,8 +55,14 @@ public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGenerator } } - public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, ?string $operationName = null, array $context = []): void - { + public function applyToItem( + QueryBuilder $queryBuilder, + QueryNameGeneratorInterface $queryNameGenerator, + string $resourceClass, + array $identifiers, + ?string $operationName = null, + array $context = [] + ): void { if ($resourceClass === Content::class) { $this->filterUnpublishedViewlessContent($queryBuilder); } @@ -78,7 +88,10 @@ private function filterUnpublishedViewlessContent(QueryBuilder $queryBuilder): v private function filterUnpublishedViewlessFields(QueryBuilder $queryBuilder): void { $rootAlias = $queryBuilder->getRootAliases()[0]; - $queryBuilder->join($rootAlias . '.content', 'c', Join::WITH, 'c.status = :status'); + + $queryBuilder->join($rootAlias . '.content', 'c'); + $queryBuilder->andWhere('c.status = :status'); + $queryBuilder->setParameter('status', Statuses::PUBLISHED); //todo: Fix this when https://github.com/doctrine/orm/issues/3835 closed. diff --git a/src/Doctrine/Functions/Rand.php b/src/Doctrine/Functions/Rand.php index 2056ae348..3ce195cb3 100644 --- a/src/Doctrine/Functions/Rand.php +++ b/src/Doctrine/Functions/Rand.php @@ -33,7 +33,7 @@ public function parse(\Doctrine\ORM\Query\Parser $parser): void $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); - if ($lexer->lookahead['type'] !== Lexer::T_CLOSE_PARENTHESIS) { + if ($lexer->lookahead->type !== Lexer::T_CLOSE_PARENTHESIS) { $this->expression = $parser->SimpleArithmeticExpression(); } diff --git a/src/Doctrine/Query/Cast.php b/src/Doctrine/Query/Cast.php index e8c34baa0..44d176f74 100644 --- a/src/Doctrine/Query/Cast.php +++ b/src/Doctrine/Query/Cast.php @@ -30,19 +30,19 @@ public function getSql(SqlWalker $sqlWalker): string // alternatively, test if true: $this->first->dispatch($sqlWalker)==='b2_.value', // b4_.value for /bolt/new/showcases if ($this->first->dispatch($sqlWalker) === 'b2_.value' || - $this->first->dispatch($sqlWalker) === 'b4_.value') { + $this->first->dispatch($sqlWalker) === 'b4_.value') { return $this->first->dispatch($sqlWalker); } } - if (! mb_strpos($backend_driver, 'sqlite') && $this->second === 'TEXT') { + if (!mb_strpos($backend_driver, 'sqlite') && $this->second === 'TEXT') { $this->second = 'CHAR'; } return sprintf('CAST(%s AS %s)', $this->first->dispatch($sqlWalker), $this->second - ); + ); } public function parse(Parser $parser): void @@ -52,7 +52,7 @@ public function parse(Parser $parser): void $this->first = $parser->ArithmeticPrimary(); $parser->match(Lexer::T_AS); $parser->match(Lexer::T_IDENTIFIER); - $this->second = $parser->getLexer()->token['value']; + $this->second = $parser->getLexer()->token->value; $parser->match(Lexer::T_CLOSE_PARENTHESIS); } } diff --git a/symfony.lock b/symfony.lock index 132d45ee2..7439c5acd 100644 --- a/symfony.lock +++ b/symfony.lock @@ -46,12 +46,6 @@ "cocur/slugify": { "version": "v4.0.0" }, - "coduo/php-matcher": { - "version": "4.0.0" - }, - "coduo/php-to-string": { - "version": "3.0.0" - }, "composer/ca-bundle": { "version": "1.2.6" }, diff --git a/templates/pages/about.html.twig b/templates/pages/about.html.twig index d795f8951..1f62346b6 100644 --- a/templates/pages/about.html.twig +++ b/templates/pages/about.html.twig @@ -80,7 +80,6 @@
  • PHPUnit.
  • phpspec.
  • Cypress.
  • -
  • PHP Matcher.
  • PHP Stan.
  • Easy Coding Standard.
  • Blackfire.