aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php72
1 files changed, 30 insertions, 42 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
index 24910e60..e98dd202 100644
--- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
@@ -35,19 +35,16 @@ class InstallCommandTest extends WallabagCoreTestCase
35 35
36 $command = $application->find('wallabag:install'); 36 $command = $application->find('wallabag:install');
37 37
38 // We mock the DialogHelper 38 // We mock the QuestionHelper
39 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 39 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
40 ->disableOriginalConstructor() 40 ->disableOriginalConstructor()
41 ->getMock(); 41 ->getMock();
42 $dialog->expects($this->any()) 42 $question->expects($this->any())
43 ->method('ask') 43 ->method('ask')
44 ->will($this->returnValue('test_'.uniqid('', true))); 44 ->will($this->returnValue('yes_'.uniqid('', true)));
45 $dialog->expects($this->any())
46 ->method('askConfirmation')
47 ->will($this->returnValue(true));
48 45
49 // We override the standard helper with our mock 46 // We override the standard helper with our mock
50 $command->getHelperSet()->set($dialog, 'dialog'); 47 $command->getHelperSet()->set($question, 'question');
51 48
52 $tester = new CommandTester($command); 49 $tester = new CommandTester($command);
53 $tester->execute(array( 50 $tester->execute(array(
@@ -69,19 +66,16 @@ class InstallCommandTest extends WallabagCoreTestCase
69 66
70 $command = $application->find('wallabag:install'); 67 $command = $application->find('wallabag:install');
71 68
72 // We mock the DialogHelper 69 // We mock the QuestionHelper
73 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 70 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
74 ->disableOriginalConstructor() 71 ->disableOriginalConstructor()
75 ->getMock(); 72 ->getMock();
76 $dialog->expects($this->any()) 73 $question->expects($this->any())
77 ->method('ask') 74 ->method('ask')
78 ->will($this->returnValue('test_'.uniqid('', true))); 75 ->will($this->returnValue('yes_'.uniqid('', true)));
79 $dialog->expects($this->any())
80 ->method('askConfirmation')
81 ->will($this->returnValue(true));
82 76
83 // We override the standard helper with our mock 77 // We override the standard helper with our mock
84 $command->getHelperSet()->set($dialog, 'dialog'); 78 $command->getHelperSet()->set($question, 'question');
85 79
86 $tester = new CommandTester($command); 80 $tester = new CommandTester($command);
87 $tester->execute(array( 81 $tester->execute(array(
@@ -119,19 +113,16 @@ class InstallCommandTest extends WallabagCoreTestCase
119 113
120 $command = $application->find('wallabag:install'); 114 $command = $application->find('wallabag:install');
121 115
122 // We mock the DialogHelper 116 // We mock the QuestionHelper
123 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 117 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
124 ->disableOriginalConstructor() 118 ->disableOriginalConstructor()
125 ->getMock(); 119 ->getMock();
126 $dialog->expects($this->any()) 120 $question->expects($this->any())
127 ->method('ask') 121 ->method('ask')
128 ->will($this->returnValue('test_'.uniqid('', true))); 122 ->will($this->returnValue('yes_'.uniqid('', true)));
129 $dialog->expects($this->any())
130 ->method('askConfirmation')
131 ->will($this->returnValue(true));
132 123
133 // We override the standard helper with our mock 124 // We override the standard helper with our mock
134 $command->getHelperSet()->set($dialog, 'dialog'); 125 $command->getHelperSet()->set($question, 'question');
135 126
136 $tester = new CommandTester($command); 127 $tester = new CommandTester($command);
137 $tester->execute(array( 128 $tester->execute(array(
@@ -156,13 +147,13 @@ class InstallCommandTest extends WallabagCoreTestCase
156 147
157 $command = $application->find('wallabag:install'); 148 $command = $application->find('wallabag:install');
158 149
159 // We mock the DialogHelper 150 // We mock the QuestionHelper
160 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 151 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
161 ->disableOriginalConstructor() 152 ->disableOriginalConstructor()
162 ->getMock(); 153 ->getMock();
163 154
164 $dialog->expects($this->exactly(3)) 155 $question->expects($this->exactly(3))
165 ->method('askConfirmation') 156 ->method('ask')
166 ->will($this->onConsecutiveCalls( 157 ->will($this->onConsecutiveCalls(
167 false, // don't want to reset the entire database 158 false, // don't want to reset the entire database
168 true, // do want to reset the schema 159 true, // do want to reset the schema
@@ -170,7 +161,7 @@ class InstallCommandTest extends WallabagCoreTestCase
170 )); 161 ));
171 162
172 // We override the standard helper with our mock 163 // We override the standard helper with our mock
173 $command->getHelperSet()->set($dialog, 'dialog'); 164 $command->getHelperSet()->set($question, 'question');
174 165
175 $tester = new CommandTester($command); 166 $tester = new CommandTester($command);
176 $tester->execute(array( 167 $tester->execute(array(
@@ -216,20 +207,20 @@ class InstallCommandTest extends WallabagCoreTestCase
216 207
217 $command = $application->find('wallabag:install'); 208 $command = $application->find('wallabag:install');
218 209
219 // We mock the DialogHelper 210 // We mock the QuestionHelper
220 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 211 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
221 ->disableOriginalConstructor() 212 ->disableOriginalConstructor()
222 ->getMock(); 213 ->getMock();
223 214
224 $dialog->expects($this->exactly(2)) 215 $question->expects($this->exactly(2))
225 ->method('askConfirmation') 216 ->method('ask')
226 ->will($this->onConsecutiveCalls( 217 ->will($this->onConsecutiveCalls(
227 false, // don't want to reset the entire database 218 false, // don't want to reset the entire database
228 false // don't want to create a new user 219 false // don't want to create a new user
229 )); 220 ));
230 221
231 // We override the standard helper with our mock 222 // We override the standard helper with our mock
232 $command->getHelperSet()->set($dialog, 'dialog'); 223 $command->getHelperSet()->set($question, 'question');
233 224
234 $tester = new CommandTester($command); 225 $tester = new CommandTester($command);
235 $tester->execute(array( 226 $tester->execute(array(
@@ -253,19 +244,16 @@ class InstallCommandTest extends WallabagCoreTestCase
253 244
254 $command = $application->find('wallabag:install'); 245 $command = $application->find('wallabag:install');
255 246
256 // We mock the DialogHelper 247 // We mock the QuestionHelper
257 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 248 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
258 ->disableOriginalConstructor() 249 ->disableOriginalConstructor()
259 ->getMock(); 250 ->getMock();
260 $dialog->expects($this->any()) 251 $question->expects($this->any())
261 ->method('ask') 252 ->method('ask')
262 ->will($this->returnValue('test_'.uniqid('', true))); 253 ->will($this->returnValue('yes_'.uniqid('', true)));
263 $dialog->expects($this->any())
264 ->method('askConfirmation')
265 ->will($this->returnValue(true));
266 254
267 // We override the standard helper with our mock 255 // We override the standard helper with our mock
268 $command->getHelperSet()->set($dialog, 'dialog'); 256 $command->getHelperSet()->set($question, 'question');
269 257
270 $tester = new CommandTester($command); 258 $tester = new CommandTester($command);
271 $tester->execute(array( 259 $tester->execute(array(