Skip to content

Commit

Permalink
minor: fix tests (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond authored Oct 8, 2024
1 parent d843e46 commit 23512eb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- uses: zenstruck/.github@php-cs-fixer
with:
php: 8
php: 8.1
key: ${{ secrets.GPG_PRIVATE_KEY }}
token: ${{ secrets.COMPOSER_TOKEN }}

Expand Down
23 changes: 12 additions & 11 deletions tests/DependencyInjection/ZenstruckScheduleExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\Reference;
use Zenstruck\ScheduleBundle\Command\ScheduleListCommand;
use Zenstruck\ScheduleBundle\Command\ScheduleRunCommand;
use Zenstruck\ScheduleBundle\DependencyInjection\ZenstruckScheduleExtension;
Expand Down Expand Up @@ -134,7 +135,7 @@ public function can_configure_single_server_lock_factory()
{
$this->load(['single_server_lock_factory' => 'my_factory']);

$this->assertContainerBuilderHasServiceDefinitionWithArgument(SingleServerHandler::class, 0, 'my_factory');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(SingleServerHandler::class, 0, new Reference('my_factory'));
$this->assertContainerBuilderHasServiceDefinitionWithTag(SingleServerHandler::class, 'schedule.extension_handler');
}

Expand All @@ -145,7 +146,7 @@ public function can_configure_without_overlapping_handler_lock_factory()
{
$this->load(['without_overlapping_lock_factory' => 'my_factory']);

$this->assertContainerBuilderHasServiceDefinitionWithArgument(WithoutOverlappingHandler::class, 0, 'my_factory');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(WithoutOverlappingHandler::class, 0, new Reference('my_factory'));
$this->assertContainerBuilderHasServiceDefinitionWithTag(WithoutOverlappingHandler::class, 'schedule.extension_handler');
}

Expand All @@ -156,9 +157,9 @@ public function can_configure_http_client()
{
$this->load(['http_client' => 'my_client']);

$this->assertContainerBuilderHasServiceDefinitionWithArgument(PingHandler::class, 0, 'my_client');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(PingHandler::class, 0, new Reference('my_client'));
$this->assertContainerBuilderHasServiceDefinitionWithTag(PingHandler::class, 'schedule.extension_handler');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(PingTaskRunner::class, 0, 'my_client');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(PingTaskRunner::class, 0, new Reference('my_client'));
$this->assertContainerBuilderHasServiceDefinitionWithTag(PingTaskRunner::class, 'schedule.task_runner');
}

Expand All @@ -169,7 +170,7 @@ public function can_enable_messenger_with_default_bus(): void
{
$this->load(['messenger' => null]);

$this->assertContainerBuilderHasServiceDefinitionWithArgument(MessageTaskRunner::class, 0, 'message_bus');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(MessageTaskRunner::class, 0, new Reference('message_bus'));
$this->assertContainerBuilderHasServiceDefinitionWithTag(MessageTaskRunner::class, 'schedule.task_runner');
}

Expand All @@ -180,7 +181,7 @@ public function can_enable_messenger_with_custom_bus(): void
{
$this->load(['messenger' => ['message_bus' => 'my_bus']]);

$this->assertContainerBuilderHasServiceDefinitionWithArgument(MessageTaskRunner::class, 0, 'my_bus');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(MessageTaskRunner::class, 0, new Reference('my_bus'));
$this->assertContainerBuilderHasServiceDefinitionWithTag(MessageTaskRunner::class, 'schedule.task_runner');
}

Expand All @@ -196,7 +197,7 @@ public function can_configure_email_handler()
'subject_prefix' => '[Acme Inc]',
]]);

$this->assertContainerBuilderHasServiceDefinitionWithArgument(EmailHandler::class, 0, 'my_mailer');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(EmailHandler::class, 0, new Reference('my_mailer'));
$this->assertContainerBuilderHasServiceDefinitionWithTag(EmailHandler::class, 'schedule.extension_handler');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(EmailHandler::class, 1, '[email protected]');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(EmailHandler::class, 2, '[email protected]');
Expand All @@ -216,7 +217,7 @@ public function can_configure_notifier_handler()
'subject_prefix' => '[Acme Inc]',
]]);

$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 0, 'my_notifier');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 0, new Reference('my_notifier'));
$this->assertContainerBuilderHasServiceDefinitionWithTag(NotifierHandler::class, 'schedule.extension_handler');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 1, ['chat/slack']);
$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 2, '[email protected]');
Expand All @@ -237,7 +238,7 @@ public function can_configure_notifier_handler_with_array_channel()
'subject_prefix' => '[Acme Inc]',
]]);

$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 0, 'my_notifier');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 0, new Reference('my_notifier'));
$this->assertContainerBuilderHasServiceDefinitionWithTag(NotifierHandler::class, 'schedule.extension_handler');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 1, ['chat/slack', 'teams']);
$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 2, '[email protected]');
Expand All @@ -254,7 +255,7 @@ public function minimum_email_handler_configuration()
'service' => 'my_mailer',
]]);

$this->assertContainerBuilderHasServiceDefinitionWithArgument(EmailHandler::class, 0, 'my_mailer');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(EmailHandler::class, 0, new Reference('my_mailer'));
$this->assertContainerBuilderHasServiceDefinitionWithTag(EmailHandler::class, 'schedule.extension_handler');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(EmailHandler::class, 1, null);
$this->assertContainerBuilderHasServiceDefinitionWithArgument(EmailHandler::class, 2, null);
Expand All @@ -270,7 +271,7 @@ public function minimum_notifier_handler_configuration()
'service' => 'my_notifier',
]]);

$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 0, 'my_notifier');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 0, new Reference('my_notifier'));
$this->assertContainerBuilderHasServiceDefinitionWithTag(NotifierHandler::class, 'schedule.extension_handler');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 1, []);
$this->assertContainerBuilderHasServiceDefinitionWithArgument(NotifierHandler::class, 2, null);
Expand Down
3 changes: 2 additions & 1 deletion tests/Schedule/Task/Runner/ProcessTaskRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public function can_create_failed_result()

$this->assertTrue($result->isFailure());
$this->assertSame('Exit 127: Command not found', $result->getDescription());
$this->assertSame("sh: 1: sdfsdfsdf: not found\n", $result->getOutput());
$this->assertStringContainsString('sdfsdfsdf', $result->getOutput());
$this->assertStringContainsString('not found', $result->getOutput());
}

/**
Expand Down

0 comments on commit 23512eb

Please sign in to comment.