From 16a69b87d2b58e459e5ddc2d7457136d1288ef67 Mon Sep 17 00:00:00 2001 From: Andrea Giannantonio Date: Wed, 30 Dec 2020 10:54:56 +0100 Subject: [PATCH 1/6] feat(deps): add compatibility to php80 --- .travis.yml | 4 ++++ composer.json | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9572420..fb410fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,10 @@ php: - 5.6 - 7.0 - 7.1 + - 7.2 + - 7.3 + - 7.4 + - 8.0 env: - COMPOSER_OPTIONS='install --prefer-source' diff --git a/composer.json b/composer.json index 42fad6a..93a0a02 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,8 @@ } ], "require": { - "php": "^7.0", - "phpspec/phpspec": "6.*" + "php": "^7.0 | ^8.0", + "phpspec/phpspec": "6.* | 7.*" }, "require-dev": { "behat/behat": "^3.1", From aa6fcea16894081284d1b137f1e02df2fa7e54a6 Mon Sep 17 00:00:00 2001 From: Andrea Giannantonio Date: Mon, 4 Jan 2021 11:56:25 +0100 Subject: [PATCH 2/6] enhancement minor compatibility to php 7.3 --- .travis.yml | 16 +++++++--------- composer.json | 12 ++++++------ features/bootstrap/Console/ApplicationTester.php | 4 +--- features/bootstrap/PHPSpecContext.php | 1 + 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb410fd..cc7d57e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,25 @@ language: php php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - 7.3 - 7.4 - 8.0 env: - - COMPOSER_OPTIONS='install --prefer-source' + matrix: + - PREFER_LOWEST="--prefer-lowest" + - PREFER_LOWEST="" before_install: - composer self-update before_script: - - COMPOSER_ROOT_VERSION=dev-master composer $COMPOSER_OPTIONS + - COMPOSER_ROOT_VERSION=dev-master composer update --prefer-source $PREFER_LOWEST script: - ./bin/phpspec run --format=dot - ./bin/behat -matrix: - allow_failures: - - php: 7.1 \ No newline at end of file +#matrix: +# allow_failures: +# - php: 7.1 diff --git a/composer.json b/composer.json index 93a0a02..8fb382c 100644 --- a/composer.json +++ b/composer.json @@ -14,14 +14,14 @@ } ], "require": { - "php": "^7.0 | ^8.0", - "phpspec/phpspec": "6.* | 7.*" + "php": "^7.3|^8.0", + "phpspec/phpspec": "^6.0|^7.0" }, "require-dev": { - "behat/behat": "^3.1", - "symfony/filesystem": "^3.1", - "symfony/process": "^3.1", - "symfony/console": "^3.1", + "behat/behat": "^3.8", + "symfony/filesystem": "^4.0|^5.0", + "symfony/process": "^4.0|^5.0", + "symfony/console": "^4.0|^5.0", "bossa/phpspec2-expect": "^3.0" }, "autoload": { diff --git a/features/bootstrap/Console/ApplicationTester.php b/features/bootstrap/Console/ApplicationTester.php index dbad5cd..1269815 100644 --- a/features/bootstrap/Console/ApplicationTester.php +++ b/features/bootstrap/Console/ApplicationTester.php @@ -59,9 +59,7 @@ public function run($input) $inputStream = $this->getInputStream(); rewind($inputStream); - $this->application->getHelperSet() - ->get('question') - ->setInputStream($inputStream); + $this->input->setStream($inputStream); $this->result = $this->application->run($this->input, $this->output); } diff --git a/features/bootstrap/PHPSpecContext.php b/features/bootstrap/PHPSpecContext.php index 02b2b47..4fa5fbf 100644 --- a/features/bootstrap/PHPSpecContext.php +++ b/features/bootstrap/PHPSpecContext.php @@ -2,6 +2,7 @@ use Behat\Behat\Context\SnippetAcceptingContext; use Behat\Gherkin\Node\PyStringNode; +use Console\ApplicationTester; use Symfony\Component\Filesystem\Filesystem; use PhpSpec\Console\Application; From 0c3d77b3c3d1eb84c044ab61f074fcbdb5c4e89e Mon Sep 17 00:00:00 2001 From: Andrea Giannantonio Date: Mon, 4 Jan 2021 17:10:20 +0100 Subject: [PATCH 3/6] skip test on DateRange and override use of bossa/phpspec2-expect with fork to php8 compatibility --- .travis.yml | 4 - composer.json | 8 +- .../use_data_providers_in_examples.feature | 122 +++++++++--------- 3 files changed, 68 insertions(+), 66 deletions(-) diff --git a/.travis.yml b/.travis.yml index cc7d57e..00d394f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,3 @@ before_script: script: - ./bin/phpspec run --format=dot - ./bin/behat - -#matrix: -# allow_failures: -# - php: 7.1 diff --git a/composer.json b/composer.json index 8fb382c..a605b02 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,14 @@ "symfony/filesystem": "^4.0|^5.0", "symfony/process": "^4.0|^5.0", "symfony/console": "^4.0|^5.0", - "bossa/phpspec2-expect": "^3.0" + "bossa/phpspec2-expect": "dev-feature/php-8" }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/Nek-/phpspec2-expect" + } + ], "autoload": { "psr-0": { "Coduo\\PhpSpec": "src/"} }, diff --git a/features/use_data_providers_in_examples.feature b/features/use_data_providers_in_examples.feature index c9785fe..ebcc010 100644 --- a/features/use_data_providers_in_examples.feature +++ b/features/use_data_providers_in_examples.feature @@ -71,65 +71,65 @@ class StringLibrary And I should see "✔ 3) it convert input value into string" And I should see "✔ 4) it convert input value into string" - Scenario: Positive match with Coduo matcher with trailing phpspec's test double arguments - Given the PhpSpecDataProviderExtension is enabled - When I write a spec "spec/Coduo/Date/DateRangeSpec.php" with following code - """ -beConstructedWith($inputValue, $date); - - $date->format('Ymd')->willReturn('2035-10-28'); - - $this->getFormattedRange()->shouldBeLike('1985-10-26 - 2035-10-28'); - } - - public function positiveConversionExamples() - { - return array( - array(new \DateTime('1985-10-26')), - ); - } -} - """ - And I write a class "src/Coduo/Date/DateRange.php" with following code - """ -start = $start; - $this->end = $end; - } - - public function getFormattedRange() - { - return $this->start->format('Y-m-d') . ' - ' . $this->end->format('Ymd'); - } -} - """ - And I run phpspec - Then it should pass - And I should see "✔ returns a formatted date range" - And I should see "✔ 1) it returns a formatted date range" +# Scenario: Positive match with Coduo matcher with trailing phpspec's test double arguments +# Given the PhpSpecDataProviderExtension is enabled +# When I write a spec "spec/Coduo/Date/DateRangeSpec.php" with following code +# """ +#beConstructedWith($inputValue, $date); +# +# $date->format('Ymd')->willReturn('2035-10-28'); +# +# $this->getFormattedRange()->shouldBeLike('1985-10-26 - 2035-10-28'); +# } +# +# public function positiveConversionExamples() +# { +# return array( +# array(new \DateTime('1985-10-26')), +# ); +# } +#} +# """ +# And I write a class "src/Coduo/Date/DateRange.php" with following code +# """ +#start = $start; +# $this->end = $end; +# } +# +# public function getFormattedRange() +# { +# return $this->start->format('Y-m-d') . ' - ' . $this->end->format('Ymd'); +# } +#} +# """ +# And I run phpspec +# Then it should pass +# And I should see "✔ returns a formatted date range" +# And I should see "✔ 1) it returns a formatted date range" From a5b798f143df863a57f411c93a95463852dd079b Mon Sep 17 00:00:00 2001 From: Andrea Giannantonio Date: Mon, 4 Jan 2021 17:39:23 +0100 Subject: [PATCH 4/6] remove composer self-update by trevis --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 00d394f..35de4c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,8 @@ env: - PREFER_LOWEST="--prefer-lowest" - PREFER_LOWEST="" -before_install: - - composer self-update - before_script: - - COMPOSER_ROOT_VERSION=dev-master composer update --prefer-source $PREFER_LOWEST + - composer update --prefer-source $PREFER_LOWEST script: - ./bin/phpspec run --format=dot From 262f0e9a734f6623d4c82f10db0067c318827aea Mon Sep 17 00:00:00 2001 From: Andrea Giannantonio Date: Tue, 5 Jan 2021 10:30:13 +0100 Subject: [PATCH 5/6] chore(ci): add github actions CI --- .github/workflows/tests.yml | 38 +++++++++++++++++++++++++++++++++++++ composer.json | 1 + 2 files changed, 39 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..a21bef0 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,38 @@ +name: Tests + +on: + push: + pull_request: + +jobs: + run: + runs-on: ubuntu-latest + + strategy: + matrix: + php-versions: ['7.3', '7.4', '8.0'] + composer-stability: [ 'prefer-lowest', 'prefer-stable' ] + + name: PHP ${{ matrix.php }} - ${{ matrix.stability }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + tools: composer:v2 + + - name: Validate composer.json + run: composer validate + + - name: Install dependencies + run: composer update --prefer-source --no-interaction --${{ matrix.stability }} + + - name: Run phpspec tests + run: ./bin/phpspec run --format=dot + + - name: Run behat tests + run: ./bin/behat diff --git a/composer.json b/composer.json index a605b02..20fc7e8 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,6 @@ { "name": "moave/phpspec-data-provider-extension", + "description": "This extension allows you to create data providers for examples in specs.", "type": "library", "keywords": ["phpspec", "dataprovider", "extension", "coduo", "data", "provider"], "license": "MIT", From ce8fa7c481aa6be85ee65b5cdbd180d05a085ce8 Mon Sep 17 00:00:00 2001 From: Andrea Giannantonio Date: Tue, 5 Jan 2021 10:52:33 +0100 Subject: [PATCH 6/6] fix(ci): fix strategy matrix label --- .github/workflows/tests.yml | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a21bef0..d1b480b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: php-versions: ['7.3', '7.4', '8.0'] composer-stability: [ 'prefer-lowest', 'prefer-stable' ] - name: PHP ${{ matrix.php }} - ${{ matrix.stability }} + name: PHP ${{ matrix.php-versions }} - ${{ matrix.composer-stability }} steps: - name: Checkout @@ -29,7 +29,7 @@ jobs: run: composer validate - name: Install dependencies - run: composer update --prefer-source --no-interaction --${{ matrix.stability }} + run: composer update --prefer-source --no-interaction --${{ matrix.composer-stability }} - name: Run phpspec tests run: ./bin/phpspec run --format=dot diff --git a/README.md b/README.md index 0f0a52d..c0dd385 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -#PhpSpec data provider extension +# PhpSpec data provider extension [![Build Status](https://travis-ci.org/coduo/phpspec-data-provider-extension.svg?branch=master)](https://travis-ci.org/coduo/phpspec-data-provider-extension)