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.
Passed
Branch master (3b9792)
by Tomasz
01:41
created

StaticEnumTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testExceptionMissingProperty() 0 9 1
A testMembers() 0 8 1
1
<?php
2
declare(strict_types=1);
3
namespace Thunder\Platenum\Tests;
4
5
use Thunder\Platenum\Exception\PlatenumException;
6
use Thunder\Platenum\Enum\StaticEnumTrait;
7
use Thunder\Platenum\Tests\Fake\FakeEnum;
8
9
/**
10
 * @author Tomasz Kowalczyk <[email protected]>
11
 */
12
final class StaticEnumTest extends AbstractTestCase
13
{
14
    public function testMembers(): void
15
    {
16
        $members = ['FIRST' => 1, 'SECOND' => 2];
17
        $trait = $this->makeStaticTraitEnum($members);
18
        $extends = $this->makeStaticExtendsEnum($members);
19
20
        $this->assertSame($members, $trait::getMembersAndValues());
21
        $this->assertSame($members, $extends::getMembersAndValues());
22
    }
23
24
    public function testExceptionMissingProperty(): void
25
    {
26
        /** @var FakeEnum $enum */
27
        $enum = $this->computeUniqueClassName('X');
28
        eval('class '.$enum.' { use '.StaticEnumTrait::class.'; }');
0 ignored issues
show
introduced by
The use of eval() is discouraged.
Loading history...
29
30
        $this->expectException(PlatenumException::class);
31
        $this->expectExceptionMessage('Enum '.$enum.' requires static property $mapping with members definitions.');
32
        $enum::FIRST();
33
    }
34
}
35