diff --git a/.github/workflows/diagnostics.yml b/.github/workflows/diagnostics.yml index 0e8fda5..d7d9a39 100644 --- a/.github/workflows/diagnostics.yml +++ b/.github/workflows/diagnostics.yml @@ -11,10 +11,7 @@ jobs: fail-fast: false matrix: include: - - php: 7.4 - output: '-o github-action -o default' - phpcq_install: 'install' - - php: 8.0 + - php: 8.2 output: '-o default' phpcq_install: 'update' @@ -31,7 +28,7 @@ jobs: php-version: ${{ matrix.php }} - name: PHP ${{ matrix.php }} Cache composer cache directory - uses: actions/cache@v1 + uses: actions/cache@v3 env: cache-name: composer-cache-dir with: @@ -39,7 +36,7 @@ jobs: key: ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }} - name: PHP ${{ matrix.php }} Cache vendor directory - uses: actions/cache@v1 + uses: actions/cache@v3 env: cache-name: composer-vendor with: @@ -49,7 +46,7 @@ jobs: ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}- - name: PHP ${{ matrix.php }} Cache phpcq directory - uses: actions/cache@v1 + uses: actions/cache@v3 env: cache-name: phpcq with: @@ -68,7 +65,7 @@ jobs: run: ./vendor/bin/phpcq run -v ${{ matrix.output }} - name: PHP ${{ matrix.php }} Upload build directory to artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: ${{ success() }} || ${{ failure() }} with: name: phpcq-builds-php-${{ matrix.php }} diff --git a/composer.json b/composer.json index b878777..0952cc2 100644 --- a/composer.json +++ b/composer.json @@ -22,17 +22,13 @@ "source": "https://github.com/contao-community-alliance/url-builder" }, "require": { - "php": "^5.6 || ^7.0 || ^8.0" + "php": "^8.2" }, "require-dev": { - "contao/core-bundle": "^4.4", - "php-http/guzzle6-adapter": "^1.1", + "contao/core-bundle": "^5.3.x-dev", + "php-http/guzzle7-adapter": "^1.0", "phpcq/runner-bootstrap": "^1.0@dev", - "symfony/security-csrf": "^4.4 || ^5.2" - }, - "conflict": { - "contao/core-bundle": "<4.4 || >=5.0", - "symfony/security-csrf": "<4.4 || >=6.0" + "symfony/security-csrf": "^6.3" }, "autoload": { "psr-4": { @@ -47,13 +43,13 @@ "config": { "allow-plugins": { "composer/package-versions-deprecated": true, - "contao-components/installer": false + "contao-components/installer": false, + "php-http/discovery": true } }, "extra": { "branch-alias": { - "dev-develop": "1.4.x-dev", - "dev-master": "1.3.x-dev" + "dev-feature/2.0.0": "2.0.x-dev" } } } diff --git a/src/Contao/BackendUrlBuilder.php b/src/Contao/BackendUrlBuilder.php deleted file mode 100644 index 3b8d20d..0000000 --- a/src/Contao/BackendUrlBuilder.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @author Sven Baumann - * @copyright 2014-2017 Contao Community Alliance. - * @license https://github.com/contao-community-alliance/url-builder/blob/master/LICENSE LGPL-3.0 - * @filesource - */ - -namespace ContaoCommunityAlliance\UrlBuilder\Contao; - -use ContaoCommunityAlliance\UrlBuilder\UrlBuilder; -use RuntimeException; - -/** - * URL builder for the Contao Backend. - * - * @package ContaoCommunityAlliance\UrlBuilder\Contao - * - * @deprecated The backend url builder is deprecated since 1.3 and removed in 2.0. - * Use instead csrf url builder. - */ -class BackendUrlBuilder extends UrlBuilder -{ - /** - * Retrieve the serialized query string. - * - * @return string - * - * @throws RuntimeException If no REQUEST_TOKEN constant exists. - */ - public function getQueryString() - { - $query = (string) parent::getQueryString(); - if (!empty($query)) { - $query .= '&'; - } - - if (!defined('REQUEST_TOKEN')) { - throw new RuntimeException('Request token not defined - can not append to query string.'); - } - $token = (string) REQUEST_TOKEN; - - $query .= 'rt=' . $token; - - return $query; - } -} diff --git a/tests/Contao/BackendUrlBuilderTest.php b/tests/Contao/BackendUrlBuilderTest.php deleted file mode 100644 index 618a2af..0000000 --- a/tests/Contao/BackendUrlBuilderTest.php +++ /dev/null @@ -1,83 +0,0 @@ - - * @author Sven Baumann - * @copyright 2014-2017 Contao Community Alliance. - * @license https://github.com/contao-community-alliance/url-builder/blob/master/LICENSE LGPL-3.0 - * @filesource - */ - -namespace ContaoCommunityAlliance\UrlBuilder\Test\Contao; - -use ContaoCommunityAlliance\UrlBuilder\Contao\BackendUrlBuilder; -use ContaoCommunityAlliance\UrlBuilder\Test\TestCase; - -/** - * Main test class for BackendUrlBuilder class. - */ -class BackendUrlBuilderTest extends TestCase -{ - /** - * Test that an exception is thrown when the constant is not defined. - * - * @return void - * - * @runInSeparateProcess - */ - public function testThrowsExceptionWithoutConstant() - { - $test = new BackendUrlBuilder('http://secure.c-c-a.org'); - - $this->expectException(\RuntimeException::class); - $this->expectExceptionMessage('Request token not defined'); - - $test->getUrl(); - } - - /** - * Test that the request token get's appended. - * - * @return void - * - * @runInSeparateProcess - */ - public function testAppendedRequestToken() - { - define('REQUEST_TOKEN', 'requestToken'); - - $url = 'http://user:secret@secure.c-c-a.org:80/secure/path?auth=1&token=123&perform#top'; - $expected = 'http://user:secret@secure.c-c-a.org:80/secure/path?auth=1&token=123&perform&rt=requestToken#top'; - $test = new BackendUrlBuilder($url); - - $this->assertSame($expected, $test->getUrl()); - } - - /** - * Test that the request token get's appended. - * - * @return void - * - * @runInSeparateProcess - */ - public function testAppendedRequestTokenAsOnlyParameter() - { - define('REQUEST_TOKEN', 'requestToken'); - - $url = 'http://user:secret@secure.c-c-a.org:80/secure/path#top'; - $expected = 'http://user:secret@secure.c-c-a.org:80/secure/path?rt=requestToken#top'; - $test = new BackendUrlBuilder($url); - - $this->assertSame($expected, $test->getUrl()); - } -}