Skip to content

Commit

Permalink
Fix tests (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
romkatsu committed Dec 22, 2021
1 parent 7a78221 commit a8237c0
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tests/Unit/QueueFactoryTest.php
Expand Up @@ -8,6 +8,7 @@
use PHPUnit\Framework\TestCase;
use stdClass;
use Yiisoft\Factory\Factory;
use Yiisoft\Test\Support\Container\SimpleContainer;
use Yiisoft\Yii\Queue\Adapter\AdapterInterface;
use Yiisoft\Yii\Queue\Exception\AdapterConfiguration\ChannelIncorrectlyConfigured;
use Yiisoft\Yii\Queue\Exception\AdapterConfiguration\ChannelNotConfiguredException;
Expand All @@ -27,7 +28,7 @@ public function testRuntimeDefinitionSuccessful(): void
$factory = new QueueFactory(
[],
$queue,
new Factory(),
$this->createYiiFactory(),
true,
$adapter
);
Expand All @@ -38,12 +39,14 @@ public function testRuntimeDefinitionSuccessful(): void
public function testThrowExceptionOnEmptyAdapter(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Either $enableRuntimeChannelDefinition must be false, or $defaultAdapter should be provided.');
$this->expectExceptionMessage(
'Either $enableRuntimeChannelDefinition must be false, or $defaultAdapter should be provided.'
);

new QueueFactory(
[],
$this->createMock(QueueInterface::class),
new Factory(),
$this->createYiiFactory(),
true
);
}
Expand All @@ -56,7 +59,7 @@ public function testThrowExceptionOnEmptyDefinition(): void
$factory = new QueueFactory(
[],
$queue,
new Factory(),
$this->createYiiFactory(),
false
);

Expand All @@ -71,7 +74,7 @@ public function testThrowExceptionOnIncorrectDefinition(): void
$factory = new QueueFactory(
['test' => new stdClass()],
$queue,
new Factory(),
$this->createYiiFactory(),
false
);

Expand All @@ -89,7 +92,7 @@ public function testSuccessfulDefinitionWithDefaultAdapter(): void
$factory = new QueueFactory(
['test' => $adapterNew],
$queue,
new Factory(),
$this->createYiiFactory(),
false,
$adapterDefault
);
Expand All @@ -107,10 +110,15 @@ public function testSuccessfulDefinitionWithoutDefaultAdapter(): void
$factory = new QueueFactory(
['test' => $adapterNew],
$queue,
new Factory(),
$this->createYiiFactory(),
false
);

$factory->get('test');
}

private function createYiiFactory(): Factory
{
return new Factory(new SimpleContainer());
}
}

0 comments on commit a8237c0

Please sign in to comment.