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

CreateConstraintActionTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A itCanCreateConstraintsWithoutSuffix() 0 7 1
A getAction() 0 10 1
A isThrowsAnExceptionIfConstraintShortNameNotSet() 0 5 1
A itCanCreateConstraintsWithSuffix() 0 7 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Medium\CodeGeneration\Action;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Action\CreateConstraintAction;
6
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractTest;
7
8
/**
9
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Action\CreateConstraintAction
10
 * @medium
11
 */
12
class CreateConstraintActionTest extends AbstractTest
13
{
14
    public const WORK_DIR = AbstractTest::VAR_PATH . '/' . AbstractTest::TEST_TYPE_MEDIUM
15
                            . '/CreateConstraintActionTest';
16
17
    private const CONSTRAINTS_PATH = self::WORK_DIR . '/src/Validation/Constraints';
18
19
20
    /**
21
     * @test
22
     */
23
    public function itCanCreateConstraintsWithoutSuffix(): void
24
    {
25
        $this->getAction()
26
             ->setConstraintShortName('IsGreen')
27
             ->run();
28
        self::assertFileExists(self::CONSTRAINTS_PATH . '/IsGreenConstraint.php');
29
        self::assertFileExists(self::CONSTRAINTS_PATH . '/IsGreenConstraintValidator.php');
30
    }
31
32
    private function getAction(): CreateConstraintAction
33
    {
34
        /**
35
         * @var CreateConstraintAction $action
36
         */
37
        $action = $this->container->get(CreateConstraintAction::class)
38
                                  ->setProjectRootDirectory(self::WORK_DIR)
39
                                  ->setProjectRootNamespace(self::TEST_PROJECT_ROOT_NAMESPACE);
40
41
        return $action;
42
    }
43
44
    /**
45
     * @test
46
     */
47
    public function itCanCreateConstraintsWithSuffix(): void
48
    {
49
        $this->getAction()
50
             ->setConstraintShortName('IsRedConstraint')
51
             ->run();
52
        self::assertFileExists(self::CONSTRAINTS_PATH . '/IsRedConstraint.php');
53
        self::assertFileExists(self::CONSTRAINTS_PATH . '/IsRedConstraintValidator.php');
54
    }
55
56
    public function isThrowsAnExceptionIfConstraintShortNameNotSet()
57
    {
58
        $this->expectException(\RuntimeException::class);
59
        $this->expectException('You must call setContraintShortname before calling run');
60
        $this->getAction()->run();
61
    }
62
}
63