Skip to content

Commit

Permalink
feat: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfedr committed Apr 8, 2024
1 parent 39fd0bf commit b9031bb
Show file tree
Hide file tree
Showing 8 changed files with 825 additions and 948 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ on:

jobs:
tests:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
version:
- php: '8.0'
- php: '8.3'
symfony: '5.4'
- php: '8.0'
symfony: '6.0'
- php: '8.3'
symfony: '6.4'
- php: '8.3'
symfony: '7.0'
name: PHP ${{ matrix.version.php }} Symfony ${{ matrix.version.symfony }}
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"require-dev": {
"symfony/phpunit-bridge": "^5.0|^6.0|^7.0",
"doctrine/doctrine-bundle": "^2",
"phpunit/phpunit": "^9",
"phpunit/phpunit": "^11",
"friendsofphp/php-cs-fixer": "^3.0",
"symfony/monolog-bundle": "^3.0|^4.0",
"symfony/browser-kit": "^5.0|^6.0|^7.0",
Expand Down
1,719 changes: 791 additions & 928 deletions composer.lock

Large diffs are not rendered by default.

22 changes: 13 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" colors="true">
<coverage>
<include>
<directory>src</directory>
</include>
<exclude>
<directory>src/*/*Bundle/Resources</directory>
</exclude>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php">
<php>
<ini name="error_reporting" value="-1"/>
<server name="KERNEL_DIR" value="tests/"/>
Expand All @@ -19,4 +15,12 @@
<directory>tests/*/*Bundle</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src</directory>
</include>
<exclude>
<directory>src/*/*Bundle/Resources</directory>
</exclude>
</source>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class RedisFactory
/**
* @throws \ErrorException
*/
public static function get(string $host, int $port = 6379, int $timeout = 5, string $prefix = null): \Redis
public static function get(string $host, int $port = 6379, int $timeout = 5, ?string $prefix = null): \Redis
{
set_error_handler(function ($severity, $message, $file, $line) {
if ($severity & error_reporting()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Ekreative\HealthCheckBundle\Controller;

use PHPUnit\Framework\Attributes\CoversNothing;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

/**
* @internal
*
* @coversNothing
*/
#[CoversNothing]
class HealthCheckControllerTest extends WebTestCase
{
public function testAction()
Expand Down Expand Up @@ -43,10 +43,10 @@ public function testAction()
$this->assertTrue($data['app']);

$this->assertIsBool($data['database']);
$this->assertTrue($data['app']);
$this->assertTrue($data['database']);

$this->assertIsBool($data['redis']);
$this->assertTrue($data['app']);
$this->assertTrue($data['redis']);
}

public function testMySQLFailAction()
Expand Down
9 changes: 9 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

use Symfony\Component\ErrorHandler\ErrorHandler;

// Register the error handler to avoid the error handler warning from Phpunit 11
// https://github.com/symfony/symfony/issues/53812#issuecomment-1962311843
ErrorHandler::register(null, false);
1 change: 0 additions & 1 deletion tests/config_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ framework:
utf8: true
secret: 'fake_secret'
http_method_override: true
handle_all_throwables: false
php_errors:
log: true

Expand Down

0 comments on commit b9031bb

Please sign in to comment.