|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Drupal\Tests\mongodb_watchdog\Unit; |
|
6
|
|
|
|
|
7
|
|
|
use Drupal\Core\Form\FormState; |
|
|
|
|
|
|
8
|
|
|
use Drupal\Core\Form\FormStateInterface; |
|
|
|
|
|
|
9
|
|
|
use Drupal\mongodb_watchdog\Controller\ArgumentResolver\FormStateValueResolver; |
|
10
|
|
|
use Drupal\Tests\UnitTestCase; |
|
|
|
|
|
|
11
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
|
|
|
|
|
12
|
|
|
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; |
|
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Test the FormStateValueResolver mechanisms. |
|
16
|
|
|
* |
|
17
|
|
|
* @coversDefaultClass \Drupal\mongodb_watchdog\Controller\ArgumentResolver\FormStateValueResolver |
|
18
|
|
|
* |
|
19
|
|
|
* @group mongodb |
|
20
|
|
|
*/ |
|
21
|
|
|
class FormStateValueResolverTest extends UnitTestCase { |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Test formState argument resolution. |
|
25
|
|
|
* |
|
26
|
|
|
* @covers ::supports |
|
27
|
|
|
*/ |
|
28
|
|
|
public function testFormStateArgumentResolver(): void { |
|
29
|
|
|
$resolver = new FormStateValueResolver(); |
|
30
|
|
|
$request = new Request(); |
|
31
|
|
|
$request->attributes->add([FormStateValueResolver::NAME_LEGACY => new FormState()]); |
|
32
|
|
|
$argument = new ArgumentMetadata('formState', FormStateInterface::class, FALSE, FALSE, NULL, FALSE); |
|
33
|
|
|
|
|
34
|
|
|
$this->assertEquals(TRUE, $resolver->supports($request, $argument)); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Test extra optional argument resolution. |
|
39
|
|
|
* |
|
40
|
|
|
* @covers ::supports |
|
41
|
|
|
*/ |
|
42
|
|
|
public function testOptionalExtraArgumentResolver(): void { |
|
43
|
|
|
$resolver = new FormStateValueResolver(); |
|
44
|
|
|
$request = new Request(); |
|
45
|
|
|
$request->attributes->add([FormStateValueResolver::NAME_LEGACY => new FormState()]); |
|
46
|
|
|
$argument = new ArgumentMetadata('extra', NULL, FALSE, TRUE, '', TRUE); |
|
47
|
|
|
|
|
48
|
|
|
$this->assertEquals(FALSE, $resolver->supports($request, $argument)); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
} |
|
52
|
|
|
|
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