Code Duplication    Length = 37-37 lines in 2 locations

Tests/Functional/Command/InvalidatePathCommandTest.php 1 location

@@ 16-52 (lines=37) @@
13
14
use Symfony\Component\Console\Output\OutputInterface;
15
16
class InvalidatePathCommandTest extends CommandTestCase
17
{
18
    public function testExecute()
19
    {
20
        $client = self::createClient();
21
        $client->getContainer()->mock(
22
            'fos_http_cache.cache_manager',
23
            '\FOS\HttpCacheBundle\CacheManager'
24
        )
25
            ->shouldReceive('supports')->andReturn(true)
26
            ->shouldReceive('invalidatePath')->once()->with('http://example.com/my/path')
27
            ->shouldReceive('invalidatePath')->once()->with('http://example.com/other/path')
28
            ->shouldReceive('flush')->once()->andReturn(2)
29
        ;
30
31
        $output = $this->runCommand($client, 'fos:httpcache:invalidate:path http://example.com/my/path http://example.com/other/path');
32
        $this->assertEquals('', $output);
33
    }
34
35
    public function testExecuteVerbose()
36
    {
37
        $client = self::createClient();
38
        $client->getContainer()->mock(
39
            'fos_http_cache.cache_manager',
40
            '\FOS\HttpCacheBundle\CacheManager'
41
        )
42
            ->shouldReceive('supports')->andReturn(true)
43
            ->shouldReceive('invalidatePath')->once()->with('http://example.com/my/path')
44
            ->shouldReceive('invalidatePath')->once()->with('http://example.com/other/path')
45
            ->shouldReceive('flush')->once()->andReturn(2)
46
        ;
47
48
        $output = $this->runCommand($client, 'fos:httpcache:invalidate:path http://example.com/my/path http://example.com/other/path', OutputInterface::VERBOSITY_VERBOSE);
49
50
        $this->assertEquals("Sent 2 invalidation request(s)\n", $output);
51
    }
52
}
53

Tests/Functional/Command/RefreshPathCommandTest.php 1 location

@@ 16-52 (lines=37) @@
13
14
use Symfony\Component\Console\Output\OutputInterface;
15
16
class RefreshPathCommandTest extends CommandTestCase
17
{
18
    public function testExecute()
19
    {
20
        $client = self::createClient();
21
        $client->getContainer()->mock(
22
            'fos_http_cache.cache_manager',
23
            '\FOS\HttpCacheBundle\CacheManager'
24
        )
25
            ->shouldReceive('supports')->andReturn(true)
26
            ->shouldReceive('refreshPath')->once()->with('http://example.com/my/path')
27
            ->shouldReceive('refreshPath')->once()->with('http://example.com/other/path')
28
            ->shouldReceive('flush')->once()->andReturn(2)
29
        ;
30
31
        $output = $this->runCommand($client, 'fos:httpcache:refresh:path http://example.com/my/path http://example.com/other/path');
32
        $this->assertEquals('', $output);
33
    }
34
35
    public function testExecuteVerbose()
36
    {
37
        $client = self::createClient();
38
        $client->getContainer()->mock(
39
            'fos_http_cache.cache_manager',
40
            '\FOS\HttpCacheBundle\CacheManager'
41
        )
42
            ->shouldReceive('supports')->andReturn(true)
43
            ->shouldReceive('refreshPath')->once()->with('http://example.com/my/path')
44
            ->shouldReceive('refreshPath')->once()->with('http://example.com/other/path')
45
            ->shouldReceive('flush')->once()->andReturn(2)
46
        ;
47
48
        $output = $this->runCommand($client, 'fos:httpcache:refresh:path http://example.com/my/path http://example.com/other/path', OutputInterface::VERBOSITY_VERBOSE);
49
50
        $this->assertEquals("Sent 2 invalidation request(s)\n", $output);
51
    }
52
}
53