GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 75bdf9...8faa57 )
by joseph
83:56 queued 81:04
created

ConstraintCreatorTest::getConstraintCreator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Small\CodeGeneration\Creation\Src\Validation\Constraints;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Src\Validation\Constraints\ConstraintCreator;
6
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FileFactory;
7
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FindReplaceFactory;
8
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\File\Writer;
9
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\NamespaceHelper;
10
use EdmondsCommerce\DoctrineStaticMeta\Config;
11
use EdmondsCommerce\DoctrineStaticMeta\Tests\Small\ConfigTest;
12
use PHPUnit\Framework\TestCase;
13
14
/**
15
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Src\Validation\Constraints\ConstraintCreator
16
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\AbstractCreator
17
 */
18
class ConstraintCreatorTest extends TestCase
19
{
20
    /**
21
     * @test
22
     * @small
23
     */
24
    public function itCanCreateANewFileObjectWithTheCorrectContent()
25
    {
26
        $newObjectFqn = 'EdmondsCommerce\\DoctrineStaticMeta\\Validation\\Constraints\\IsBlueConstraint';
27
        $file         = $this->getConstraintCreator()
28
                             ->createTargetFileObject($newObjectFqn)
29
                             ->getTargetFile();
30
        $expected     = '<?php declare(strict_types=1);
31
32
namespace EdmondsCommerce\DoctrineStaticMeta\Validation\Constraints;
33
34
use Symfony\Component\Validator\Constraint;
35
36
/**
37
 * This is a template constraint. The Constraint does very little other than specify a message and imply a
38
 * ConstraintValidator with the same FQN as this class, but with `Validator` appended.
39
 *
40
 * @see https://symfony.com/doc/2.6/cookbook/validation/custom_constraint.html
41
 *
42
 * Suggest using the `./bin/doctrine dsm:override:create` command to create a new
43
 * override straight after you generate the file.
44
 *
45
 * Then you can edit it and update your override as required using
46
 * `./bin/doctrine dsm:overrides:update -a fromProject`
47
 *
48
 * And then reapply after a new build using
49
 * `./bin/doctrine dsm:overrides:update -a toProject`
50
 *
51
 */
52
class IsBlueConstraint extends Constraint
53
{
54
    public const VALUE_TYPE = \'(template value type)\';
55
56
    public const MESSAGE = \'The value %s is not a valid \' . self::VALUE_TYPE;
57
58
    public $message = self::MESSAGE;
59
}';
60
        $actual       = $file->getContents();
61
        self::assertSame($expected, $actual);
62
    }
63
64
    private function getConstraintCreator(): ConstraintCreator
65
    {
66
        $namespaceHelper = new NamespaceHelper();
67
        $config          = new Config(ConfigTest::SERVER);
68
69
        return new ConstraintCreator(
70
            new FileFactory($namespaceHelper, $config),
71
            $namespaceHelper,
72
            new Writer(),
73
            $config,
74
            new FindReplaceFactory()
75
        );
76
    }
77
}
78