Skip to content

Commit

Permalink
feat: allow PHPUnit 11
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris8934 authored and Chris53897 committed Jun 13, 2024
1 parent 2f93d26 commit eb7e7ce
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
5 changes: 2 additions & 3 deletions Tests/Twig/Extension/CurrencyExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Locale;
use Money\Currency;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Tbbc\MoneyBundle\Formatter\MoneyFormatter;
use Tbbc\MoneyBundle\Twig\Extension\CurrencyExtension;
Expand All @@ -30,9 +31,7 @@ public function testName(): void
self::assertSame('tbbc_money_currency_extension', $this->extension->getName());
}

/**
* @dataProvider getCurrencyTests
*/
#[DataProvider('getCurrencyTests')]
public function testCurrency($template, $expected): void
{
$this->assertSame($expected, $this->getTemplate($template)->render($this->variables));
Expand Down
5 changes: 2 additions & 3 deletions Tests/Twig/Extension/MoneyExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Locale;
use Money\Currency;
use Money\Money;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Tbbc\MoneyBundle\Formatter\MoneyFormatter;
Expand Down Expand Up @@ -52,9 +53,7 @@ public function testName(): void
self::assertSame('tbbc_money_extension', $this->extension->getName());
}

/**
* @dataProvider getMoneyTests
*/
#[DataProvider('getMoneyTests')]
public function testMoney($template, $expected): void
{
$this->assertSame($expected, $this->getTemplate($template)->render($this->variables));
Expand Down
7 changes: 7 additions & 0 deletions Tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
declare(strict_types=1);

use Symfony\Component\ErrorHandler\ErrorHandler;

# PHPUnit 11 needs this, otherwise there is an error 'Test code or tested code did not remove its own exception handlers'
ErrorHandler::register(null, false);
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"florianv/exchanger": "^2.8.1",
"php-http/message": "^1.0",
"php-http/guzzle7-adapter": "^1.0",
"vimeo/psalm": "^5.20",
"symfony/phpunit-bridge": "^5.4|^6.0|^7.0",
"phpunit/phpunit": "^10.5.9",
"vimeo/psalm": "^5.20 || 6.x-dev as 6.0.0",
"symfony/phpunit-bridge": "^7.0",
"phpunit/phpunit": "^10.5.9|^11.0.3",
"symfony/yaml": "^5.4|^6.0|^7.0",
"http-interop/http-factory-guzzle": "^1.2"
},
Expand Down

0 comments on commit eb7e7ce

Please sign in to comment.