From f6c6a80055f88bb8b0cf54dad62049ef2a09f49f Mon Sep 17 00:00:00 2001 From: Martin Parsiegla Date: Thu, 27 Jun 2024 17:27:06 +0200 Subject: [PATCH 1/3] Run phpunit tests via github action --- .github/workflows/phpunit.yaml | 38 ++++++++++++++++++++++++++++++++++ .travis.yml | 23 -------------------- 2 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/phpunit.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/phpunit.yaml b/.github/workflows/phpunit.yaml new file mode 100644 index 0000000..c6632a0 --- /dev/null +++ b/.github/workflows/phpunit.yaml @@ -0,0 +1,38 @@ +name: PHPUnit + +on: + push: + branches: [ main ] + pull_request: + types: [ opened, reopened, synchronize ] + +jobs: + run: + runs-on: 'ubuntu-latest' + strategy: + fail-fast: true + matrix: + include: + - php: '8.1' + composer: 'composer:v2' + - php: '8.2' + composer: 'composer:v2' + - php: '8.3' + composer: 'composer:v2' + + name: PHP ${{ matrix.php }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: ${{ matrix.composer }} + + - name: Composer install + run: composer install + + - name: PHPUnit tests + run: ./bin/phpunit --verbose --debug diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 75e48aa..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: php - -sudo: false - -cache: - directories: - - $HOME/.composer/cache/files - -matrix: - include: - - php: 7.2 - - php: 7.2 - env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable' - - php: 7.3 - - php: 7.4 - - php: 8.0 - fast_finish: true - -before_install: composer self-update - -install: composer update $COMPOSER_FLAGS --prefer-source -n - -script: bin/phpunit --verbose From 12d4183996002d92c6d8080285eeeb0b977bdbd8 Mon Sep 17 00:00:00 2001 From: Martin Parsiegla Date: Thu, 27 Jun 2024 17:30:51 +0200 Subject: [PATCH 2/3] Support symfony 7 --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 0beeec9..27e6627 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "php": "^8.1", "php-amqplib/php-amqplib": "^3.0.0", "doctrine/annotations": "^1.13.3|^2.0.1", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^6.4|^7.0", "doctrine/collections": "^1.6|^2.1.2" }, "require-dev": { @@ -23,8 +23,8 @@ "phpunit/phpunit": "^9.5.10", "codeception/verify": "^2.1.1", "league/statsd": "~1.5", - "symfony/stopwatch": "^4.4|^5.0", - "symfony/serializer": "^4.4|^5.0", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/serializer": "^6.4|^7.0", "psr/log": "^1.0", "phpspec/prophecy-phpunit": "^2.0" }, From 853634b237b32d96f9511b47b2b34622be118626 Mon Sep 17 00:00:00 2001 From: Martin Parsiegla Date: Thu, 27 Jun 2024 17:31:21 +0200 Subject: [PATCH 3/3] Fix issue with missing return type when using PHP `8.2` --- .../Tests/Amqp/Consumer/Annotation/ConsumerContainerTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Rebuy/Tests/Amqp/Consumer/Annotation/ConsumerContainerTest.php b/tests/Rebuy/Tests/Amqp/Consumer/Annotation/ConsumerContainerTest.php index 45ce6ac..dff8b52 100644 --- a/tests/Rebuy/Tests/Amqp/Consumer/Annotation/ConsumerContainerTest.php +++ b/tests/Rebuy/Tests/Amqp/Consumer/Annotation/ConsumerContainerTest.php @@ -27,7 +27,7 @@ public function invoke_should_invoke_reflection() $consumer = new Consumer(); $reflectionMethod = $this->prophesize(ReflectionMethod::class); - $reflectionMethod->invoke($consumer, $payload)->shouldBeCalled(); + $reflectionMethod->invoke($consumer, $payload)->willReturn(''); $container = new ConsumerContainer( self::TEST_PREFIX, @@ -36,6 +36,9 @@ public function invoke_should_invoke_reflection() new ConsumerAnnotation('name') ); $container->invoke($payload); + + $reflectionMethod->invoke($consumer, $payload)->shouldHaveBeenCalled(); + } /**