|
1
|
|
|
<?php |
|
2
|
|
|
namespace Bdf\QueueBundle\Tests; |
|
3
|
|
|
|
|
4
|
|
|
require_once __DIR__.'/TestKernel.php'; |
|
5
|
|
|
|
|
6
|
|
|
use Bdf\Queue\Connection\Prime\PrimeConnection; |
|
|
|
|
|
|
7
|
|
|
use Bdf\Queue\Console\Command\Failer\AbstractFailerCommand; |
|
8
|
|
|
use Bdf\Queue\Failer\DbFailedJobStorage; |
|
|
|
|
|
|
9
|
|
|
use Bdf\Queue\Failer\FailedJobRepositoryAdapter; |
|
10
|
|
|
use Bdf\Queue\Failer\FailedJobStorageInterface; |
|
11
|
|
|
use PHPUnit\Framework\TestCase; |
|
12
|
|
|
use Symfony\Bundle\FrameworkBundle\Console\Application; |
|
13
|
|
|
|
|
14
|
|
|
class WithPrimeTest extends TestCase |
|
15
|
|
|
{ |
|
16
|
|
|
protected function setUp(): void |
|
17
|
|
|
{ |
|
18
|
|
|
if (!class_exists(PrimeConnection::class)) { |
|
19
|
|
|
$this->markTestSkipped('b2pweb/bdf-queue-prime-adapter not installed'); |
|
20
|
|
|
} |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @return void |
|
25
|
|
|
*/ |
|
26
|
|
|
public function test_prime_failer() |
|
27
|
|
|
{ |
|
28
|
|
|
$kernel = new \TestKernel(__DIR__ . '/Fixtures/conf_with_prime_failer.yaml'); |
|
29
|
|
|
$kernel->boot(); |
|
30
|
|
|
$console = new Application($kernel); |
|
31
|
|
|
|
|
32
|
|
|
$command = $console->get('queue:failer:delete'); |
|
33
|
|
|
|
|
34
|
|
|
$r = new \ReflectionProperty(AbstractFailerCommand::class, 'repository'); |
|
35
|
|
|
$r->setAccessible(true); |
|
36
|
|
|
|
|
37
|
|
|
/** @var FailedJobStorageInterface $failer */ |
|
38
|
|
|
$failer = $r->getValue($command); |
|
39
|
|
|
|
|
40
|
|
|
$this->assertTrue($this->isPrimeFailer($failer)); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
private function isPrimeFailer($storage): bool |
|
44
|
|
|
{ |
|
45
|
|
|
if ($storage instanceof DbFailedJobRepository) { |
|
|
|
|
|
|
46
|
|
|
return true; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
if ($storage instanceof FailedJobRepositoryAdapter) { |
|
50
|
|
|
$r = new \ReflectionProperty(FailedJobRepositoryAdapter::class, 'storage'); |
|
51
|
|
|
$r->setAccessible(true); |
|
52
|
|
|
|
|
53
|
|
|
return $r->getValue($storage) instanceof DbFailedJobStorage; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
return false; |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths