Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with PHPUnit 11 #493

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ class AddSwiftMailerTransportPassTest extends TestCase

private $definition;

/**
* @before
*/
protected function doSetUp()
protected function setUp(): void
{
$this->compilerPass = new AddSwiftMailerTransportPass();
$this->definition = new Definition(null, [new Reference('swiftmailer')]);
Expand Down
6 changes: 3 additions & 3 deletions Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testProcessSimpleCase()
$this->assertFalse($config['handlers']['foobar']['nested']);
}

public function provideProcessStringChannels()
public static function provideProcessStringChannels(): array
{
return [
['foo', 'foo', true],
Expand Down Expand Up @@ -74,7 +74,7 @@ public function testProcessStringChannels($string, $expectedString, $isInclusive
$this->assertEquals($expectedString, $config['handlers']['foobar']['channels']['elements'][0]);
}

public function provideGelfPublisher()
public static function provideGelfPublisher(): array
{
return [
[
Expand Down Expand Up @@ -532,7 +532,7 @@ public function testWithProcessPsr3Messages(array $configuration, array $process
$this->assertEquals($processedConfiguration, $config['handlers']['main']['process_psr_3_messages']);
}

public function processPsr3MessagesProvider(): iterable
public static function processPsr3MessagesProvider(): iterable
{
yield 'Not specified' => [[], ['enabled' => null]];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use PHPUnit\Framework\TestCase;

abstract class DependencyInjectionTest extends TestCase
abstract class DependencyInjectionTestCase extends TestCase
{
/**
* Assertion on the Class of a DIC Service Definition.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

abstract class FixtureMonologExtensionTest extends DependencyInjectionTest
abstract class FixtureMonologExtensionTestCase extends DependencyInjectionTestCase
{
public function testLoadWithSeveralHandlers()
{
Expand Down
26 changes: 6 additions & 20 deletions Tests/DependencyInjection/MonologExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpFoundation\RequestStack;

class MonologExtensionTest extends DependencyInjectionTest
class MonologExtensionTest extends DependencyInjectionTestCase
{
public function testLoadWithDefault()
{
Expand Down Expand Up @@ -628,7 +628,7 @@ public function testV2Removed(array $handlerOptions)
$loader->load([['handlers' => ['main' => $handlerOptions]]], $container);
}

public function v2RemovedDataProvider(): array
public static function v2RemovedDataProvider(): array
{
return [
[['type' => 'hipchat', 'token' => 'abc123', 'room' => 'foo']],
Expand All @@ -637,33 +637,19 @@ public function v2RemovedDataProvider(): array
];
}

/**
* @dataProvider v1AddedDataProvider
*/
public function testV2AddedOnV1(string $handlerType)
public function testV2AddedOnV1()
{
if (Logger::API !== 1) {
$this->markTestSkipped('Only valid on Monolog V1');

return;
}

$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage(
\sprintf('"%s" was added in Monolog v2, please upgrade if you wish to use it.', $handlerType)
);
$this->expectExceptionMessage('"fallbackgroup" was added in Monolog v2, please upgrade if you wish to use it.');

$container = new ContainerBuilder();
$loader = new MonologExtension();

$loader->load([['handlers' => ['main' => ['type' => $handlerType]]]], $container);
}

public function v1AddedDataProvider(): array
{
return [
['fallbackgroup'],
];
$loader->load([['handlers' => ['main' => ['type' => 'fallbackgroup']]]], $container);
}

/**
Expand All @@ -684,7 +670,7 @@ public function testLogLevelfromParameter(array $parameters, array $config, $exp
$this->assertDICConstructorArguments($definition, $expectedArgs);
}

public function provideLoglevelParameterConfig(): array
public static function provideLoglevelParameterConfig(): array
{
return [
'browser console with parameter level' => [
Expand Down
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/XmlMonologExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

class XmlMonologExtensionTest extends FixtureMonologExtensionTest
class XmlMonologExtensionTest extends FixtureMonologExtensionTestCase
{
protected function loadFixture(ContainerBuilder $container, $fixture)
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/YamlMonologExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class YamlMonologExtensionTest extends FixtureMonologExtensionTest
class YamlMonologExtensionTest extends FixtureMonologExtensionTestCase
{
protected function loadFixture(ContainerBuilder $container, $fixture)
{
Expand Down
Loading