Code Duplication    Length = 23-29 lines in 3 locations

test/RoaveTest/ComposerGpgVerify/Package/GitPackageTest.php 3 locations

@@ 62-88 (lines=27) @@
59
        );
60
    }
61
62
    public function testWillReportSuccessfulVerificationWithMultipleChecks() : void
63
    {
64
        $verification = GitPackage::fromPackageAndSignatureChecks(
65
            $this->package,
66
            $this->makeSignatureCheck(true, 'yadda'),
67
            $this->makeSignatureCheck(true, 'dadda'),
68
            $this->makeSignatureCheck(true, 'wadda'),
69
            $this->makeSignatureCheck(false, 'nope')
70
        );
71
72
        self::assertInstanceOf(GitPackage::class, $verification);
73
        self::assertSame($this->packageName, $verification->packageName());
74
        self::assertTrue($verification->isVerified());
75
        self::assertSame(
76
            <<<REASON
77
The following GIT GPG signature checks passed for package "{$this->packageName}":
78
79
yadda
80
81
dadda
82
83
wadda
84
REASON
85
            ,
86
            $verification->printReason()
87
        );
88
    }
89
90
    public function testWillReportFailedVerification() : void
91
    {
@@ 111-139 (lines=29) @@
108
        );
109
    }
110
111
    public function testWillReportFailedVerificationWithMultipleChecks() : void
112
    {
113
        $verification = GitPackage::fromPackageAndSignatureChecks(
114
            $this->package,
115
            $this->makeSignatureCheck(false, 'yadda'),
116
            $this->makeSignatureCheck(false, 'dadda'),
117
            $this->makeSignatureCheck(false, 'wadda'),
118
            $this->makeSignatureCheck(false, 'nope')
119
        );
120
121
        self::assertInstanceOf(GitPackage::class, $verification);
122
        self::assertSame($this->packageName, $verification->packageName());
123
        self::assertFalse($verification->isVerified());
124
        self::assertSame(
125
            <<<REASON
126
The following GIT GPG signature checks have failed for package "{$this->packageName}":
127
128
yadda
129
130
dadda
131
132
wadda
133
134
nope
135
REASON
136
            ,
137
            $verification->printReason()
138
        );
139
    }
140
141
    public function testWillReportSuccessfulVerificationWithMultipleChecksAndSuccessfulOneNotFirst() : void
142
    {
@@ 141-163 (lines=23) @@
138
        );
139
    }
140
141
    public function testWillReportSuccessfulVerificationWithMultipleChecksAndSuccessfulOneNotFirst() : void
142
    {
143
        $verification = GitPackage::fromPackageAndSignatureChecks(
144
            $this->package,
145
            $this->makeSignatureCheck(false, 'yadda'),
146
            $this->makeSignatureCheck(false, 'dadda'),
147
            $this->makeSignatureCheck(false, 'wadda'),
148
            $this->makeSignatureCheck(true, 'yarp')
149
        );
150
151
        self::assertInstanceOf(GitPackage::class, $verification);
152
        self::assertSame($this->packageName, $verification->packageName());
153
        self::assertTrue($verification->isVerified());
154
        self::assertSame(
155
            <<<REASON
156
The following GIT GPG signature checks passed for package "{$this->packageName}":
157
158
yarp
159
REASON
160
            ,
161
            $verification->printReason()
162
        );
163
    }
164
165
    private function makeSignatureCheck(bool $passed, string $reasoning) : GitSignatureCheck
166
    {