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 ( 647edc...edf045 )
by joseph
18s queued 16s
created

FileCreationTransactionIntegrationTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
dl 0
loc 69
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testCanEchoFindCommands() 0 4 1
A testCanAddFile() 0 3 1
A testPathsDeduplicated() 0 4 1
A getFindCommands() 0 9 1
A testMarkSuccessfulClearsTransaction() 0 5 1
A setup() 0 7 2
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator;
4
5
use EdmondsCommerce\DoctrineStaticMeta\AbstractIntegrationTest;
6
7
class FileCreationTransactionIntegrationTest extends AbstractIntegrationTest
8
{
9
    public const WORK_DIR    = AbstractIntegrationTest::VAR_PATH.'/'.self::TEST_TYPE.'/FileCreationTransactionTest/';
10
    public const TEST_PATH_1 = self::WORK_DIR.'1.txt';
11
    public const TEST_PATH_2 = self::WORK_DIR.'2.txt';
12
13
    /**
14
     * @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
15
     * @SuppressWarnings(PHPMD.StaticAccess)
16
     */
17
    public function setup()
18
    {
19
        parent::setup();
20
        FileCreationTransaction::markTransactionSuccessful();
21
        foreach ([self::TEST_PATH_1, self::TEST_PATH_2] as $path) {
22
            file_put_contents($path, $path);
23
            FileCreationTransaction::setPathCreated($path);
24
        }
25
    }
26
27
    /**
28
     * @SuppressWarnings(PHPMD.StaticAccess)
29
     */
30
    public function testCanAddFile()
31
    {
32
        $this->assertCount(2, FileCreationTransaction::getTransaction());
33
    }
34
35
    /**
36
     * @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
37
     * @SuppressWarnings(PHPMD.StaticAccess)
38
     */
39
    public function testPathsDeduplicated()
40
    {
41
        FileCreationTransaction::setPathCreated(self::TEST_PATH_1);
42
        $this->assertCount(2, FileCreationTransaction::getTransaction());
43
    }
44
45
    /**
46
     */
47
    public function testCanEchoFindCommands()
48
    {
49
        $output = $this->getFindCommands();
50
        $this->assertNotEmpty($output);
51
    }
52
53
    /**
54
     * @return string
55
     * @SuppressWarnings(PHPMD.StaticAccess)
56
     */
57
    protected function getFindCommands(): string
58
    {
59
        $handle = fopen('php://memory', 'rwb');
60
        FileCreationTransaction::echoDirtyTransactionCleanupCommands($handle);
61
        rewind($handle);
0 ignored issues
show
Bug introduced by
It seems like $handle can also be of type false; however, parameter $handle of rewind() does only seem to accept resource, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

61
        rewind(/** @scrutinizer ignore-type */ $handle);
Loading history...
62
        $output = stream_get_contents($handle);
0 ignored issues
show
Bug introduced by
It seems like $handle can also be of type false; however, parameter $handle of stream_get_contents() does only seem to accept resource, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

62
        $output = stream_get_contents(/** @scrutinizer ignore-type */ $handle);
Loading history...
63
        fclose($handle);
0 ignored issues
show
Bug introduced by
It seems like $handle can also be of type false; however, parameter $handle of fclose() does only seem to accept resource, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

63
        fclose(/** @scrutinizer ignore-type */ $handle);
Loading history...
64
65
        return (string)$output;
66
    }
67
68
    /**
69
     * @SuppressWarnings(PHPMD.StaticAccess)
70
     */
71
    public function testMarkSuccessfulClearsTransaction()
72
    {
73
        FileCreationTransaction::markTransactionSuccessful();
74
        $output = $this->getFindCommands();
75
        $this->assertEmpty($output);
76
    }
77
}
78