@@ 24-32 (lines=9) @@ | ||
21 | $this->runner = new \Robo\Runner('\Robo\RoboFileFixture'); |
|
22 | } |
|
23 | ||
24 | public function testNoOptionsNoConfiguration() |
|
25 | { |
|
26 | // Run without any config and without any options |
|
27 | $argv = ['placeholder', 'test:simple-list']; |
|
28 | $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
29 | ||
30 | $this->guy->seeInOutput("a: '1'"); |
|
31 | $this->guy->seeInOutput("b: '2'"); |
|
32 | } |
|
33 | ||
34 | public function testOptionsButNoConfiguration() |
|
35 | { |
|
@@ 34-42 (lines=9) @@ | ||
31 | $this->guy->seeInOutput("b: '2'"); |
|
32 | } |
|
33 | ||
34 | public function testOptionsButNoConfiguration() |
|
35 | { |
|
36 | // Set one option, but provide no config |
|
37 | $argv = ['placeholder', 'test:simple-list', '--b=3']; |
|
38 | $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
39 | ||
40 | $this->guy->seeInOutput("a: '1'"); |
|
41 | $this->guy->seeInOutput("b: '3'"); |
|
42 | } |
|
43 | ||
44 | public function testWithConfigurationButNoOptions() |
|
45 | { |
@@ 72-83 (lines=12) @@ | ||
69 | $this->guy->seeInOutput('Some text in section one.'); |
|
70 | } |
|
71 | ||
72 | public function testCommandEventHook() |
|
73 | { |
|
74 | $argv = ['placeholder', 'test:command-event']; |
|
75 | $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
76 | ||
77 | $expected = <<<EOT |
|
78 | This is the command-event hook for the test:command-event command. |
|
79 | This is the main method for the test:command-event command. |
|
80 | This is the post-command hook for the test:command-event command. |
|
81 | EOT; |
|
82 | $this->guy->seeInOutput($expected); |
|
83 | } |
|
84 | ||
85 | public function testCustomEventHook() |
|
86 | { |
|
@@ 85-92 (lines=8) @@ | ||
82 | $this->guy->seeInOutput($expected); |
|
83 | } |
|
84 | ||
85 | public function testCustomEventHook() |
|
86 | { |
|
87 | $argv = ['placeholder', 'test:custom-event']; |
|
88 | $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
89 | ||
90 | $expected = 'one,two'; |
|
91 | $this->guy->seeInOutput($expected); |
|
92 | } |
|
93 | ||
94 | public function testRoboStaticRunMethod() |
|
95 | { |
|
@@ 102-108 (lines=7) @@ | ||
99 | $this->guy->seeInOutput('Some text in section one.'); |
|
100 | } |
|
101 | ||
102 | public function testDeploy() |
|
103 | { |
|
104 | $argv = ['placeholder', 'test:deploy', '--simulate']; |
|
105 | $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
106 | $this->guy->seeInOutput('[Simulator] Simulating Remote\\Ssh(\'mysite.com\', null)'); |
|
107 | $this->guy->seeInOutput('[Simulator] Running ssh mysite.com \'cd "/var/www/somesite" && git pull\''); |
|
108 | } |
|
109 | ||
110 | public function testRunnerTryError() |
|
111 | { |
|
@@ 110-117 (lines=8) @@ | ||
107 | $this->guy->seeInOutput('[Simulator] Running ssh mysite.com \'cd "/var/www/somesite" && git pull\''); |
|
108 | } |
|
109 | ||
110 | public function testRunnerTryError() |
|
111 | { |
|
112 | $argv = ['placeholder', 'test:error']; |
|
113 | $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
114 | ||
115 | $this->guy->seeInOutput('[Exec] Running ls xyzzy'); |
|
116 | $this->assertTrue($result > 0); |
|
117 | } |
|
118 | ||
119 | public function testRunnerTrySimulatedError() |
|
120 | { |
|
@@ 119-126 (lines=8) @@ | ||
116 | $this->assertTrue($result > 0); |
|
117 | } |
|
118 | ||
119 | public function testRunnerTrySimulatedError() |
|
120 | { |
|
121 | $argv = ['placeholder', 'test:error', '--simulate']; |
|
122 | $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
123 | ||
124 | $this->guy->seeInOutput('Simulating Exec'); |
|
125 | $this->assertEquals(0, $result); |
|
126 | } |
|
127 | ||
128 | public function testRunnerTryException() |
|
129 | { |
|
@@ 128-135 (lines=8) @@ | ||
125 | $this->assertEquals(0, $result); |
|
126 | } |
|
127 | ||
128 | public function testRunnerTryException() |
|
129 | { |
|
130 | $argv = ['placeholder', 'test:exception', '--task']; |
|
131 | $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
132 | ||
133 | $this->guy->seeInOutput('Task failed with an exception'); |
|
134 | $this->assertEquals(1, $result); |
|
135 | } |
|
136 | ||
137 | public function testInitCommand() |
|
138 | { |
|
@@ 154-161 (lines=8) @@ | ||
151 | $this->assertContains('class RoboTestClass', $commandContents); |
|
152 | } |
|
153 | ||
154 | public function testTasksStopOnFail() |
|
155 | { |
|
156 | $argv = ['placeholder', 'test:stop-on-fail']; |
|
157 | $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); |
|
158 | ||
159 | $this->guy->seeInOutput('['); |
|
160 | $this->assertTrue($result > 0); |
|
161 | } |
|
162 | ||
163 | public function testInvalidRoboDirectory() |
|
164 | { |