Code Duplication    Length = 32-34 lines in 2 locations

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

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