Code Duplication    Length = 26-28 lines in 2 locations

src/TestBundle/Tests/Command/TestsRunCommandTest.php 2 locations

@@ 60-85 (lines=26) @@
57
        $this->assertRecentResultsPersisted();
58
    }
59
    
60
    public function testVerboselyWhenAllPass()
61
    {
62
        $this->createSocketReadMock();
63
        
64
        $returnCode = $this->execute([], [
65
            'verbosity' => Output::VERBOSITY_VERBOSE
66
        ]);
67
        
68
        $this->assertEquals(0, $returnCode);
69
        $this->assertCountLinesOfOutput(5);
70
        
71
        $this->assertHasStandardOutput();
72
        $this->assertStringStartsWith(' > ' . TestFixtures::$tests['test-1'] . ' : PASSED - Pinged in ', $this->output[1]);
73
        $this->assertRegExp('/0\.[0-9]+s$/', $this->output[1]);
74
        
75
        $this->assertStringStartsWith(' > ' . TestFixtures::$tests['test-2'] . ' : PASSED - Pinged in ', $this->output[2]);
76
        $this->assertRegExp('/0\.[0-9]+s$/', $this->output[2]);
77
        
78
        $this->assertStringStartsWith(' > ' . TestFixtures::$tests['test-3'] . ' : PASSED - Pinged in ', $this->output[3]);
79
        $this->assertRegExp('/0\.[0-9]+s$/', $this->output[3]);
80
        
81
        $this->assertCountRunTests();
82
        $this->assertResults(0, 0, 0, count(TestFixtures::$tests));
83
        
84
        $this->assertRecentResultsPersisted();
85
    }
86
    
87
    public function testDiscardsResults()
88
    {
@@ 165-192 (lines=28) @@
162
        $this->assertRecentResultsPersisted();
163
    }
164
    
165
    public function testVerboseMixedResults()
166
    {
167
        $this->createSocketReadMockForMixedResults();
168
        
169
        $returnCode = $this->execute([], [
170
            'verbosity' => Output::VERBOSITY_VERBOSE
171
        ]);
172
        
173
        $this->assertEquals(2, $returnCode);
174
        $this->assertCountLinesOfOutput(5);
175
        
176
        $this->assertHasStandardOutput();
177
        
178
        $this->assertStringStartsWith(' > ' . TestFixtures::$tests['test-1'] . ' : PASSED - Pinged in ', $this->output[1]);
179
        $this->assertRegExp('/0\.[0-9]+s$/', $this->output[1]);
180
        
181
        $this->assertStringStartsWith(' > ' . TestFixtures::$tests['test-2'] . ' : UNSATISFACTORY - ', $this->output[2]);
182
        $this->assertRegExp('/responded in 1\.[0-9]+ s, above the unsatisfactory threshold \(1 s\)$/', $this->output[2]);
183
        
184
        $this->assertStringStartsWith(' > ' . TestFixtures::$tests['test-3'] . ' : FAILED - ', $this->output[3]);
185
        $this->assertStringEndsWith('failed to respond in the timeout threshold (2 s)', $this->output[3]);
186
        
187
        
188
        $this->assertCountRunTests();
189
        $this->assertResults(1, 0, 1, (count(TestFixtures::$tests) - 2));
190
        
191
        $this->assertRecentResultsPersisted();
192
    }
193
    
194
    private function createSocketMocks()
195
    {