Code Duplication    Length = 32-34 lines in 2 locations

src/Paraunit/Tests/Functional/RunnerTest.php 2 locations

@@ 98-129 (lines=32) @@
95
        );
96
    }
97
98
    public function testSegFault()
99
    {
100
        if (!extension_loaded('sigsegv')) {
101
            $this->markTestSkipped('The segfault cannot be reproduced in this environment');
102
        }
103
104
        $outputInterface = new ConsoleOutputStub();
105
106
        $runner = $this->container->get('paraunit.runner.runner');
107
108
        $fileArray = array(
109
            'src/Paraunit/Tests/Stub/SegFaultTestStub.php',
110
        );
111
112
        $this->assertNotEquals(
113
            0,
114
            $runner->run($fileArray, $outputInterface, new PHPUnitConfigFile('')),
115
            'Exit code should not be 0'
116
        );
117
118
        $this->assertContains('<error>X</error>', $outputInterface->getOutput(), 'Missing X output');
119
        $this->assertContains(
120
            '1 files with SEGMENTATION FAULTS:',
121
            $outputInterface->getOutput(),
122
            'Missing recap title'
123
        );
124
        $this->assertContains(
125
            '<error>SegFaultTestStub.php</error>',
126
            $outputInterface->getOutput(),
127
            'Missing failing filename'
128
        );
129
    }
130
131
    /**
132
     * @group this
@@ 134-167 (lines=34) @@
131
    /**
132
     * @group this
133
     */
134
    public function testWarning()
135
    {
136
        $phpunitVersion = new \PHPUnit_Runner_Version();
137
138
        if ( ! preg_match('/^5\./', $phpunitVersion->id())) {
139
            $this->markTestSkipped('PHPUnit < 5 in this env, warnings are not present.');
140
        }
141
142
        $outputInterface = new ConsoleOutputStub();
143
144
        $runner = $this->container->get('paraunit.runner.runner');
145
146
        $fileArray = array(
147
            'src/Paraunit/Tests/Stub/MissingProviderTestStub.php',
148
        );
149
150
        $this->assertEquals(
151
            0,
152
            $runner->run($fileArray, $outputInterface, new PHPUnitConfigFile('')),
153
            'Exit code should be 0'
154
        );
155
156
        $this->assertContains('<warning>W</warning>', $outputInterface->getOutput(), 'Missing W output');
157
        $this->assertContains(
158
            '1 files with WARNINGS:',
159
            $outputInterface->getOutput(),
160
            'Missing recap title'
161
        );
162
        $this->assertContains(
163
            '<warning>MissingProviderTestStub.php</warning>',
164
            $outputInterface->getOutput(),
165
            'Missing warned filename'
166
        );
167
    }
168
169
    public function testRegressionFatalErrorsRecognizedAsUnknownResults()
170
    {