Changeset 21237
- Timestamp:
- 08/18/09 22:25:16 (4 years ago)
- Files:
-
- tools/lime/branches/2.0-experimental/lib/LimePrinter.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/LimeTest.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/LimeTestSuite.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputConsoleSummary.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputFactory.php (modified) (1 diff)
- tools/lime/branches/2.0-experimental/lib/output/LimeOutputTap.php (moved) (moved from tools/lime/branches/2.0-experimental/lib/output/LimeOutputConsoleDetailed.php) (5 diffs, 1 prop)
- tools/lime/branches/2.0-experimental/test/unit/LimeAnnotationSupportTest.php (modified) (20 diffs)
- tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputTapTest.php (moved) (moved from tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputConsoleDetailedTest.php) (16 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/lime/branches/2.0-experimental/lib/LimePrinter.php
r21235 r21237 43 43 $colorizer->setStyle(self::HAPPY, array('fg' => 'white', 'bg' => 'green', 'bold' => true)); 44 44 $colorizer->setStyle(self::STRING, array('fg' => 'cyan')); 45 $colorizer->setStyle(self::NUMBER, array( 'fg' => 'cyan'));45 $colorizer->setStyle(self::NUMBER, array()); 46 46 $colorizer->setStyle(self::BOOLEAN, array('fg' => 'cyan')); 47 47 $colorizer->setStyle(self::INFO, array('fg' => 'cyan', 'bold' => true)); tools/lime/branches/2.0-experimental/lib/LimeTest.php
r21230 r21237 32 32 $this->options = array( 33 33 'base_dir' => null, 34 'output' => ' detail',34 'output' => 'tap', 35 35 'force_colors' => false, 36 36 'verbose' => false, tools/lime/branches/2.0-experimental/lib/LimeTestSuite.php
r21230 r21237 51 51 if ($this->options['processes'] > 1 && !$output->supportsThreading()) 52 52 { 53 throw new LogicException(sprintf('The output "%s" does not support threading', $type));53 throw new LogicException(sprintf('The output "%s" does not support multi-processing', $type)); 54 54 } 55 55 tools/lime/branches/2.0-experimental/lib/output/LimeOutputConsoleSummary.php
r21231 r21237 104 104 if ($this->getErrors() || $this->getWarnings() || $this->getFailed() || $incomplete) 105 105 { 106 $messages = LimeOutput ConsoleDetailed::getMessages($this->getActual(),106 $messages = LimeOutputTap::getMessages($this->getActual(), 107 107 $this->getExpected(), $this->getPassed(), $this->getErrors(), $this->getWarnings()); 108 108 tools/lime/branches/2.0-experimental/lib/output/LimeOutputFactory.php
r20968 r21237 30 30 case 'summary': 31 31 return new LimeOutputConsoleSummary($printer, $this->options); 32 case ' detail':32 case 'tap': 33 33 default: 34 return new LimeOutput ConsoleDetailed($printer, $this->options);34 return new LimeOutputTap($printer, $this->options); 35 35 } 36 36 } tools/lime/branches/2.0-experimental/lib/output/LimeOutputTap.php
- Property svn:mergeinfo set
r21230 r21237 10 10 */ 11 11 12 class LimeOutput ConsoleDetailedimplements LimeOutputInterface12 class LimeOutputTap implements LimeOutputInterface 13 13 { 14 14 protected … … 19 19 $warnings = 0, 20 20 $errors = 0, 21 $file = null, 21 22 $printer = null; 22 23 … … 42 43 public function focus($file) 43 44 { 44 $this->printer->printLine('# '.$this->stripBaseDir($file), LimePrinter::INFO); 45 if ($this->file !== $file) 46 { 47 $this->printer->printLine('# '.$this->stripBaseDir($file), LimePrinter::INFO); 48 49 $this->file = $file; 50 } 45 51 } 46 52 … … 52 58 { 53 59 $this->expected += $amount; 54 $this->printer->printLine('1..'.$amount);55 60 } 56 61 … … 258 263 if (is_null($this->expected)) 259 264 { 260 $this->plan($this->actual, null); 261 } 265 $this->plan($this->actual); 266 } 267 268 $this->printer->printLine('1..'.$this->expected); 262 269 263 270 $messages = self::getMessages($this->actual, $this->expected, $this->passed, $this->errors, $this->warnings); tools/lime/branches/2.0-experimental/test/unit/LimeAnnotationSupportTest.php
r20975 r21237 73 73 $expected = <<<EOF 74 74 $root/@$file 75 1..0 76 Before 77 Test 1 78 Before 79 Test 2 75 Before 76 Test 1 77 Before 78 Test 2 79 1..0 80 80 Looks like everything went fine. 81 81 EOF; … … 91 91 $expected = <<<EOF 92 92 $root/@$file 93 1..094 93 Test 1 95 94 After 96 95 Test 2 97 96 After 97 1..0 98 98 Looks like everything went fine. 99 99 EOF; … … 109 109 $expected = <<<EOF 110 110 $root/@$file 111 1..0112 111 Before All 113 112 Test 1 114 113 Test 2 114 1..0 115 115 Looks like everything went fine. 116 116 EOF; … … 126 126 $expected = <<<EOF 127 127 $root/@$file 128 1..0129 128 Test 1 130 129 Test 2 131 130 After All 131 1..0 132 132 Looks like everything went fine. 133 133 EOF; … … 143 143 $expected = <<<EOF 144 144 $root/@$file 145 1..0146 145 Before annotation 147 146 Before 148 147 Test 148 1..0 149 149 Looks like everything went fine. 150 150 EOF; … … 160 160 $expected = <<<EOF 161 161 $root/@$file 162 1..0163 162 Try is not matched 164 163 If is not matched 164 1..0 165 165 Looks like everything went fine. 166 166 EOF … … 177 177 $expected = <<<EOF 178 178 $root/@$file 179 1..0180 179 Test 180 1..0 181 181 Looks like everything went fine. 182 182 EOF … … 201 201 $expected = <<<EOF 202 202 $root/@$file 203 1..0204 203 Before 205 204 BeforeTest 206 205 BeforeTestAfter 206 1..0 207 207 Looks like everything went fine. 208 208 EOF; … … 218 218 $expected = <<<EOF 219 219 $root/@$file 220 1..0221 220 Global 222 221 GlobalBefore 223 222 GlobalBeforeTest 224 223 GlobalBeforeTestAfter 224 1..0 225 225 Looks like everything went fine. 226 226 EOF; … … 235 235 $expected = <<<EOF 236 236 $root/@$file 237 1..0238 237 Is not set 239 238 Is not set 239 1..0 240 240 Looks like everything went fine. 241 241 EOF; … … 251 251 $expected = <<<EOF 252 252 $root/@$file 253 1..0254 253 Test 1 255 254 # This test is commented with "double" and 'single' quotes 256 255 Test 2 256 1..0 257 257 Looks like everything went fine. 258 258 EOF; … … 268 268 $expected = '/'.str_replace('%ANY%', '.*', preg_quote(<<<EOF 269 269 $root/@$file 270 1..4271 270 Test 1 272 271 not ok 1 - A "RuntimeException" was thrown … … 283 282 Test 4 284 283 ok 4 - A "RuntimeException" with code "1" was thrown 284 1..4 285 285 Looks like you failed 2 tests of 4. 286 286 EOF … … 297 297 $expected = '/'.str_replace('%ANY%', '.*', preg_quote(<<<EOF 298 298 $root/@$file 299 1..3300 299 Test 1 301 300 ok 1 - A "RuntimeException" with code "0" was thrown … … 307 306 Test 3 308 307 ok 3 - A "RuntimeException" with code "1" was thrown 308 1..3 309 309 Looks like you failed 1 tests of 3. 310 310 EOF … … 321 321 $expected = '/'.str_replace('%ANY%', '.*', preg_quote(<<<EOF 322 322 $root/@$file 323 1..2324 323 Test 1 325 324 ok 1 - A "RuntimeException" was thrown … … 329 328 # got: none 330 329 # expected: LogicException 330 1..2 331 331 Looks like you failed 1 tests of 2. 332 332 EOF … … 343 343 $expected = <<<EOF 344 344 $root/@$file 345 1..0346 345 Test 1 347 346 Test 3 347 1..0 348 348 Looks like everything went fine. 349 349 EOF; … … 410 410 $expected = <<<EOF 411 411 $root/@$file 412 1..0413 412 Test 413 1..0 414 414 Looks like everything went fine. 415 415 EOF; … … 425 425 $expected = <<<EOF 426 426 $root/@$file 427 1..0 428 Before 429 Test 1 430 Before 431 Test 2 432 Looks like everything went fine. 433 EOF; 434 $t->is($result, 0, 'The file returned exit status 0 (success)'); 435 $t->isOutput($actual, $expected); 427 Before 428 Test 1 429 Before 430 Test 2 431 1..0 432 Looks like everything went fine. 433 EOF; 434 $t->is($result, 0, 'The file returned exit status 0 (success)'); 435 $t->isOutput($actual, $expected); tools/lime/branches/2.0-experimental/test/unit/output/LimeOutputTapTest.php
- Property svn:mergeinfo set
r21230 r21237 14 14 LimeAnnotationSupport::enable(); 15 15 16 $t = new LimeTest( 64);16 $t = new LimeTest(74); 17 17 18 18 // @Before 19 19 20 20 $printer = LimeMock::createStrict('LimePrinter', $t); 21 $output = new LimeOutput ConsoleDetailed($printer);21 $output = new LimeOutputTap($printer); 22 22 23 23 … … 38 38 39 39 40 // @Test: focus() prints the filename only once 41 42 $printer->printLine('# /test/file', LimePrinter::INFO)->once(); 43 $printer->replay(); 44 // test 45 $output->focus('/test/file'); 46 $output->focus('/test/file'); 47 // assertions 48 $printer->verify(); 49 50 40 51 // @Test: The constructor accepts a base directory which is stripped from the file name 41 52 42 53 // fixtures 43 $output = new LimeOutput ConsoleDetailed($printer, array('base_dir' => '/test'));54 $output = new LimeOutputTap($printer, array('base_dir' => '/test')); 44 55 $printer->printLine('# /file', LimePrinter::INFO); 45 56 $printer->replay(); 46 57 // test 47 58 $output->focus('/test/file'); 48 // assertions49 $printer->verify();50 51 52 // @Test: plan() prints the test file and the amount of planned tests53 54 // fixtures55 $printer->printLine('1..2');56 $printer->replay();57 // test58 $output->plan(2, '/test/file');59 59 // assertions 60 60 $printer->verify(); … … 121 121 122 122 // fixtures 123 $output = new LimeOutput ConsoleDetailed($printer, array('base_dir' => '/test'));123 $output = new LimeOutputTap($printer, array('base_dir' => '/test')); 124 124 $printer->printLine('not ok 1', LimePrinter::NOT_OK); 125 125 $printer->printLine('# Failed test (/file at line 11)', LimePrinter::COMMENT); … … 205 205 206 206 // fixtures 207 $output = new LimeOutput ConsoleDetailed($printer, array('base_dir' => '/test'));207 $output = new LimeOutputTap($printer, array('base_dir' => '/test')); 208 208 $printer->printLargeBox("A very important warning\n(in /file on line 11)", LimePrinter::WARNING); 209 209 $printer->replay(); … … 231 231 232 232 // fixtures 233 $output = new LimeOutput ConsoleDetailed($printer, array('base_dir' => '/test'));233 $output = new LimeOutputTap($printer, array('base_dir' => '/test')); 234 234 $printer->printLargeBox("LimeError: A very important error\n(in /file on line 11)", LimePrinter::ERROR); 235 235 $printer->printLine('Exception trace:', LimePrinter::COMMENT); … … 265 265 266 266 267 // @Test: flush() prints a summary267 // @Test: flush() prints the plan and a summary 268 268 269 269 // @Test: Case 1 - Too many tests … … 274 274 $output->pass('Second test', '/test/file', 22); 275 275 $printer->reset(); 276 $printer->printLine('1..1'); 276 277 $printer->printBox(' Looks like you planned 1 tests but ran 1 extra.', LimePrinter::ERROR); 277 278 $printer->replay(); … … 288 289 $output->fail('Second test', '/test/file', 22); 289 290 $printer->reset(); 291 $printer->printLine('1..1'); 290 292 $printer->printBox(' Looks like you failed 1 tests of 2.', LimePrinter::ERROR); 291 293 $printer->printBox(' Looks like you planned 1 tests but ran 1 extra.', LimePrinter::ERROR); … … 302 304 $output->pass('First test', '/test/file', 11); 303 305 $printer->reset(); 306 $printer->printLine('1..2'); 304 307 $printer->printBox(' Looks like you planned 2 tests but only ran 1.', LimePrinter::ERROR); 305 308 $printer->replay(); … … 315 318 $output->pass('First test', '/test/file', 11); 316 319 $printer->reset(); 320 $printer->printLine('1..1'); 317 321 $printer->printBox(' Looks like everything went fine.', LimePrinter::HAPPY); 318 322 $printer->replay(); … … 330 334 $output->pass('Third test', '/test/file', 33); 331 335 $printer->reset(); 336 $printer->printLine('1..3'); 332 337 $printer->printBox(' Looks like you failed 1 tests of 3.', LimePrinter::ERROR); 333 338 $printer->replay(); … … 344 349 $output->fail('Second test', '/test/file', 22); 345 350 $printer->reset(); 351 $printer->printLine('1..3'); 346 352 $printer->printBox(' Looks like you failed 1 tests of 2.', LimePrinter::ERROR); 347 353 $printer->printBox(' Looks like you planned 3 tests but only ran 2.', LimePrinter::ERROR); … … 371 377 $output->skip('First test', '/test/file', 11); 372 378 $printer->reset(); 379 $printer->printLine('1..1'); 373 380 $printer->printBox(' Looks like everything went fine.', LimePrinter::HAPPY); 374 381 $printer->replay(); … … 385 392 $output->warning('Some warning', '/test/file', 11); 386 393 $printer->reset(); 394 $printer->printLine('1..1'); 387 395 $printer->printBox(' Looks like you\'re nearly there.', LimePrinter::WARNING); 388 396 $printer->replay(); … … 399 407 $output->error(new LimeError('Some error', '/test/file', 11)); 400 408 $printer->reset(); 409 $printer->printLine('1..1'); 401 410 $printer->printBox(' Looks like some errors occurred.', LimePrinter::ERROR); 402 411 $printer->replay(); … … 414 423 $output->pass('Second test', '/test/file', 11); 415 424 $printer->reset(); 425 $printer->printLine('1..2'); 416 426 $printer->printBox(' Looks like everything went fine.', LimePrinter::HAPPY); 417 427 $printer->replay();