1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace App\Tests\Crossword\Features\Receiver; |
6
|
|
|
|
7
|
|
|
use App\Crossword\Features\Receiver\CrosswordReceiver; |
8
|
|
|
use App\Crossword\Features\Receiver\ReceiveCrosswordException; |
9
|
|
|
use App\Crossword\Features\Receiver\Type\Type; |
10
|
|
|
use App\Crossword\Infrastructure\Cache\CacheItem; |
11
|
|
|
use App\Crossword\Infrastructure\Cache\InMemoryClient; |
12
|
|
|
use App\Crossword\Infrastructure\Repository\Redis\ReadCrosswordRepository; |
13
|
|
|
use Psr\Log\NullLogger; |
|
|
|
|
14
|
|
|
use App\Tests\Crossword\CrosswordTestCase; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @coversDefaultClass \App\Crossword\Features\Receiver\CrosswordReceiver |
18
|
|
|
*/ |
19
|
|
|
final class CrosswordReceiverTest extends CrosswordTestCase |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @covers ::receive |
23
|
|
|
*/ |
24
|
|
|
public function testSuccessfullyReceived(): void |
25
|
|
|
{ |
26
|
|
|
$data = ['data' => 'value']; |
27
|
|
|
$cache = new InMemoryClient(); |
28
|
|
|
$cache->save(new CacheItem('ua-normal-3', [time() => json_encode(['data' => 'value'], JSON_THROW_ON_ERROR)])); |
29
|
|
|
|
30
|
|
|
$crosswordReceiver = new CrosswordReceiver(new ReadCrosswordRepository($cache), new NullLogger()); |
31
|
|
|
$crossword = $crosswordReceiver->receive(sprintf('%s-%s-%d', 'ua', Type::NORMAL, 3)); |
32
|
|
|
|
33
|
|
|
self::assertSame($crossword, $data); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @covers ::receive |
38
|
|
|
*/ |
39
|
|
|
public function testThrowExceptionWhenCrosswordNotFoundInTheStorage(): void |
40
|
|
|
{ |
41
|
|
|
$this->expectException(ReceiveCrosswordException::class); |
42
|
|
|
|
43
|
|
|
$crosswordReceiver = new CrosswordReceiver(new ReadCrosswordRepository(new InMemoryClient()), new NullLogger()); |
44
|
|
|
$crosswordReceiver->receive(sprintf('%s-%s-%d', 'ua', Type::NORMAL, 3)); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
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