Completed
Push — master ( 8b8afe...5f2bbe )
by Greg
02:21
created

tests/unit/Task/GulpTest.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
use AspectMock\Test as test;
3
4
use Robo\Traits\Common\AdjustQuotes;
5
6
class GulpTest extends \Codeception\TestCase\Test
7
{
8
    use AdjustQuotes;
9
10
    /**
11
     * @var \AspectMock\Proxy\ClassProxy
12
     */
13
    protected $baseGulp;
14
15
    protected function _before()
16
    {
17
        $this->baseGulp = test::double('Robo\Task\Gulp\Base', [
18
            'output' => new \Symfony\Component\Console\Output\NullOutput()
19
        ]);
20
    }
21
22
    // tests
23
    public function testGulpGetCommand()
24
    {
25
        verify(
26
            (new \Robo\Task\Gulp\Run('default','gulp'))->getCommand()
27
        )->equals($this->adjustQuotes("gulp 'default'"));
28
29
        verify(
30
            (new \Robo\Task\Gulp\Run('another','gulp'))->getCommand()
31
        )->equals($this->adjustQuotes("gulp 'another'"));
32
33
        verify(
34
            (new \Robo\Task\Gulp\Run('default','gulp'))->silent()->getCommand()
35
        )->equals($this->adjustQuotes("gulp 'default' --silent"));
36
37
        verify(
38
            (new \Robo\Task\Gulp\Run('default','gulp'))->noColor()->getCommand()
39
        )->equals($this->adjustQuotes("gulp 'default' --no-color"));
40
41
        verify(
42
            (new \Robo\Task\Gulp\Run('default','gulp'))->color()->getCommand()
43
        )->equals($this->adjustQuotes("gulp 'default' --color"));
44
45
        verify(
46
            (new \Robo\Task\Gulp\Run('default','gulp'))->simple()->getCommand()
47
        )->equals($this->adjustQuotes("gulp 'default' --tasks-simple"));
48
    }
49
50 View Code Duplication
    public function testGulpRun()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51
    {
52
        $gulp = test::double('Robo\Task\Gulp\Run', ['executeCommand' => null, 'getConfig' => new \Robo\Config(), 'logger' => new \Psr\Log\NullLogger()]);
0 ignored issues
show
Deprecated Code introduced by
The class Robo\Config has been deprecated with message: Use \Robo\Config\Config

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
53
54
        $task = (new \Robo\Task\Gulp\Run('default','gulp'))->simple();
55
        verify($task->getCommand())->equals($this->adjustQuotes("gulp 'default' --tasks-simple"));
56
        $task->run();
57
        $gulp->verifyInvoked('executeCommand', [$this->adjustQuotes("gulp 'default' --tasks-simple")]);
58
    }
59
60
    public function testGulpUnusualChars()
61
    {
62
        $isWindows = defined('PHP_WINDOWS_VERSION_MAJOR');
63
64
        if ($isWindows) {
65
66
            verify(
67
                (new \Robo\Task\Gulp\Run('anotherWith weired!("\') Chars','gulp'))->getCommand()
68
            )->equals('gulp "anotherWith weired!(\"\') Chars"');
69
70
        } else {
71
72
            verify(
73
                (new \Robo\Task\Gulp\Run('anotherWith weired!("\') Chars','gulp'))->getCommand()
74
            )->equals("gulp 'anotherWith weired!(\"'\\'') Chars'");
75
76
        }
77
    }
78
}
79