Changeset 19882
- Timestamp:
- 07/05/09 09:51:53 (7 months ago)
- Files:
-
- tools/lime/branches/2.0-experimental/lib/lime.php (modified) (60 diffs)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/can_ok.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/can_ok_fails.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/can_ok_name.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/cmp_ok.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/cmp_ok_fails.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/cmp_ok_name.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/include_ok.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/include_ok_fails.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/include_ok_name.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/is_deeply.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/is_deeply_fails.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/is_deeply_name.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/isa_ok.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/isa_ok_fails.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/isa_ok_name.phpt (modified) (1 diff)
- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/setup.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/lime/branches/2.0-experimental/lib/lime.php
r19872 r19882 16 16 * @version SVN: $Id$ 17 17 */ 18 class lime_test18 class sfLimeTest 19 19 { 20 20 const EPSILON = 0.0000000001; 21 21 22 protected $ test_nb= 0;22 protected $nbTests = 0; 23 23 protected $output = null; 24 24 protected $results = array(); 25 25 protected $options = array(); 26 26 27 static protected $all _results = array();27 static protected $allResults = array(); 28 28 29 29 public function __construct($plan = null, $options = array()) … … 42 42 ), $options); 43 43 44 $this->output = $this->options['output'] ? $this->options['output'] : new lime_output($this->options['force_colors']);44 $this->output = $this->options['output'] ? $this->options['output'] : new sfLimeOutput($this->options['force_colors']); 45 45 $this->options['base_dir'] = realpath($this->options['base_dir']); 46 46 47 $caller = $this->find _caller(debug_backtrace());48 self::$all _results[] = array(47 $caller = $this->findCaller(debug_backtrace()); 48 self::$allResults[] = array( 49 49 'file' => $caller[0], 50 50 'tests' => array(), … … 52 52 ); 53 53 54 $this->results = &self::$all _results[count(self::$all_results) - 1];54 $this->results = &self::$allResults[count(self::$allResults) - 1]; 55 55 56 56 null !== $plan and $this->output->echoln(sprintf("1..%d", $plan)); … … 59 59 static public function reset() 60 60 { 61 self::$all _results = array();62 } 63 64 static public function to _array()65 { 66 return self::$all _results;67 } 68 69 static public function to _xml($results = null)61 self::$allResults = array(); 62 } 63 64 static public function toArray() 65 { 66 return self::$allResults; 67 } 68 69 static public function toXml($results = null) 70 70 { 71 71 if (is_null($results)) 72 72 { 73 $results = self::$all _results;73 $results = self::$allResults; 74 74 } 75 75 … … 86 86 foreach ($results as $result) 87 87 { 88 $testsuites->appendChild($test suite = $dom->createElement('testsuite'));89 $test suite->setAttribute('name', basename($result['file'], '.php'));90 $test suite->setAttribute('file', $result['file']);91 $test suite->setAttribute('failures', count($result['stats']['failed']));92 $test suite->setAttribute('errors', 0);93 $test suite->setAttribute('skipped', count($result['stats']['skipped']));94 $test suite->setAttribute('tests', $result['stats']['plan']);95 $test suite->setAttribute('assertions', $result['stats']['plan']);88 $testsuites->appendChild($testSuite = $dom->createElement('testsuite')); 89 $testSuite->setAttribute('name', basename($result['file'], '.php')); 90 $testSuite->setAttribute('file', $result['file']); 91 $testSuite->setAttribute('failures', count($result['stats']['failed'])); 92 $testSuite->setAttribute('errors', 0); 93 $testSuite->setAttribute('skipped', count($result['stats']['skipped'])); 94 $testSuite->setAttribute('tests', $result['stats']['plan']); 95 $testSuite->setAttribute('assertions', $result['stats']['plan']); 96 96 97 97 $failures += count($result['stats']['failed']); … … 101 101 foreach ($result['tests'] as $test) 102 102 { 103 $test suite->appendChild($testcase = $dom->createElement('testcase'));104 $test case->setAttribute('name', $test['message']);105 $test case->setAttribute('file', $test['file']);106 $test case->setAttribute('line', $test['line']);107 $test case->setAttribute('assertions', 1);103 $testSuite->appendChild($testCase = $dom->createElement('testcase')); 104 $testCase->setAttribute('name', $test['message']); 105 $testCase->setAttribute('file', $test['file']); 106 $testCase->setAttribute('line', $test['line']); 107 $testCase->setAttribute('assertions', 1); 108 108 if (!$test['status']) 109 109 { 110 $test case->appendChild($failure = $dom->createElement('failure'));110 $testCase->appendChild($failure = $dom->createElement('failure')); 111 111 $failure->setAttribute('type', 'lime'); 112 112 if ($test['error']) … … 137 137 if ($total > $plan) 138 138 { 139 $this->output->red _bar(sprintf(" Looks like you planned %d tests but ran %d extra.", $plan, $total - $plan));139 $this->output->redBar(sprintf(" Looks like you planned %d tests but ran %d extra.", $plan, $total - $plan)); 140 140 } 141 141 elseif ($total < $plan) 142 142 { 143 $this->output->red _bar(sprintf(" Looks like you planned %d tests but only ran %d.", $plan, $total));143 $this->output->redBar(sprintf(" Looks like you planned %d tests but only ran %d.", $plan, $total)); 144 144 } 145 145 146 146 if ($failed) 147 147 { 148 $this->output->red _bar(sprintf(" Looks like you failed %d tests of %d.", $failed, $passed + $failed));148 $this->output->redBar(sprintf(" Looks like you failed %d tests of %d.", $failed, $passed + $failed)); 149 149 } 150 150 else if ($total == $plan) 151 151 { 152 $this->output->green _bar(" Looks like everything went fine.");152 $this->output->greenBar(" Looks like everything went fine."); 153 153 } 154 154 … … 166 166 public function ok($exp, $message = '') 167 167 { 168 $this->update _stats();168 $this->updateStats(); 169 169 170 170 if ($result = (boolean) $exp) 171 171 { 172 $this->results['stats']['passed'][] = $this-> test_nb;172 $this->results['stats']['passed'][] = $this->nbTests; 173 173 } 174 174 else 175 175 { 176 $this->results['stats']['failed'][] = $this-> test_nb;177 } 178 $this->results['tests'][$this-> test_nb]['message'] = $message;179 $this->results['tests'][$this-> test_nb]['status'] = $result;180 $this->output->echoln(sprintf("%s %d%s", $result ? 'ok' : 'not ok', $this-> test_nb, $message = $message ? sprintf('%s %s', 0 === strpos($message, '#') ? '' : ' -', $message) : ''));176 $this->results['stats']['failed'][] = $this->nbTests; 177 } 178 $this->results['tests'][$this->nbTests]['message'] = $message; 179 $this->results['tests'][$this->nbTests]['status'] = $result; 180 $this->output->echoln(sprintf("%s %d%s", $result ? 'ok' : 'not ok', $this->nbTests, $message = $message ? sprintf('%s %s', 0 === strpos($message, '#') ? '' : ' -', $message) : '')); 181 181 182 182 if (!$result) 183 183 { 184 $this->output->diag(sprintf(' Failed test (%s at line %d)', str_replace(getcwd(), '.', $this->results['tests'][$this-> test_nb]['file']), $this->results['tests'][$this->test_nb]['line']));184 $this->output->diag(sprintf(' Failed test (%s at line %d)', str_replace(getcwd(), '.', $this->results['tests'][$this->nbTests]['file']), $this->results['tests'][$this->nbTests]['line'])); 185 185 } 186 186 … … 214 214 if (!$result = $this->ok($value, $message)) 215 215 { 216 $this->set _last_test_errors(array(sprintf(" got: %s", var_export($exp1, true)), sprintf(" expected: %s", var_export($exp2, true))));216 $this->setLastTestErrors(array(sprintf(" got: %s", var_export($exp1, true)), sprintf(" expected: %s", var_export($exp2, true)))); 217 217 } 218 218 … … 233 233 if (!$result = $this->ok($exp1 != $exp2, $message)) 234 234 { 235 $this->set _last_test_errors(array(sprintf(" %s", var_export($exp2, true)), ' ne', sprintf(" %s", var_export($exp2, true))));235 $this->setLastTestErrors(array(sprintf(" %s", var_export($exp2, true)), ' ne', sprintf(" %s", var_export($exp2, true)))); 236 236 } 237 237 … … 252 252 if (!$result = $this->ok(preg_match($regex, $exp), $message)) 253 253 { 254 $this->set _last_test_errors(array(sprintf(" '%s'", $exp), sprintf(" doesn't match '%s'", $regex)));254 $this->setLastTestErrors(array(sprintf(" '%s'", $exp), sprintf(" doesn't match '%s'", $regex))); 255 255 } 256 256 … … 271 271 if (!$result = $this->ok(!preg_match($regex, $exp), $message)) 272 272 { 273 $this->set _last_test_errors(array(sprintf(" '%s'", $exp), sprintf(" matches '%s'", $regex)));273 $this->setLastTestErrors(array(sprintf(" '%s'", $exp), sprintf(" matches '%s'", $regex))); 274 274 } 275 275 … … 287 287 * @return boolean 288 288 */ 289 public function c mp_ok($exp1, $op, $exp2, $message = '')289 public function compare($exp1, $op, $exp2, $message = '') 290 290 { 291 291 eval(sprintf("\$result = \$exp1 $op \$exp2;")); 292 292 if (!$this->ok($result, $message)) 293 293 { 294 $this->set _last_test_errors(array(sprintf(" %s", str_replace("\n", '', var_export($exp1, true))), sprintf(" %s", $op), sprintf(" %s", str_replace("\n", '', var_export($exp2, true)))));294 $this->setLastTestErrors(array(sprintf(" %s", str_replace("\n", '', var_export($exp1, true))), sprintf(" %s", $op), sprintf(" %s", str_replace("\n", '', var_export($exp2, true))))); 295 295 } 296 296 … … 307 307 * @return boolean 308 308 */ 309 public function can_ok($object, $methods, $message = '')309 public function hasMethod($object, $methods, $message = '') 310 310 { 311 311 $result = true; 312 $failed _messages = array();312 $failedMessages = array(); 313 313 foreach ((array) $methods as $method) 314 314 { 315 315 if (!method_exists($object, $method)) 316 316 { 317 $failed _messages[] = sprintf(" method '%s' does not exist", $method);317 $failedMessages[] = sprintf(" method '%s' does not exist", $method); 318 318 $result = false; 319 319 } … … 322 322 !$this->ok($result, $message); 323 323 324 !$result and $this->set _last_test_errors($failed_messages);324 !$result and $this->setLastTestErrors($failedMessages); 325 325 326 326 return $result; … … 336 336 * @return boolean 337 337 */ 338 public function isa _ok($var, $class, $message = '')338 public function isa($var, $class, $message = '') 339 339 { 340 340 $type = is_object($var) ? get_class($var) : gettype($var); 341 341 if (!$result = $this->ok($type == $class, $message)) 342 342 { 343 $this->set _last_test_errors(array(sprintf(" variable isn't a '%s' it's a '%s'", $class, $type)));343 $this->setLastTestErrors(array(sprintf(" variable isn't a '%s' it's a '%s'", $class, $type))); 344 344 } 345 345 … … 356 356 * @return boolean 357 357 */ 358 public function is _deeply($exp1, $exp2, $message = '')359 { 360 if (!$result = $this->ok($this->test _is_deeply($exp1, $exp2), $message))361 { 362 $this->set _last_test_errors(array(sprintf(" got: %s", str_replace("\n", '', var_export($exp1, true))), sprintf(" expected: %s", str_replace("\n", '', var_export($exp2, true)))));358 public function isDeeply($exp1, $exp2, $message = '') 359 { 360 if (!$result = $this->ok($this->testIsDeeply($exp1, $exp2), $message)) 361 { 362 $this->setLastTestErrors(array(sprintf(" got: %s", str_replace("\n", '', var_export($exp1, true))), sprintf(" expected: %s", str_replace("\n", '', var_export($exp2, true))))); 363 363 } 364 364 … … 403 403 404 404 /** 405 * Counts as $nb _tests tests--useful for conditional tests405 * Counts as $nbTests tests--useful for conditional tests 406 406 * 407 407 * @param string $message display output message 408 * @param integer $nb _tests number of tests to skip408 * @param integer $nbTests number of tests to skip 409 409 * 410 410 * @return void 411 411 */ 412 public function skip($message = '', $nb _tests = 1)413 { 414 for ($i = 0; $i < $nb _tests; $i++)412 public function skip($message = '', $nbTests = 1) 413 { 414 for ($i = 0; $i < $nbTests; $i++) 415 415 { 416 416 $this->pass(sprintf("# SKIP%s", $message ? ' '.$message : '')); 417 $this->results['stats']['skipped'][] = $this-> test_nb;417 $this->results['stats']['skipped'][] = $this->nbTests; 418 418 array_pop($this->results['stats']['passed']); 419 419 } … … 430 430 { 431 431 $this->pass(sprintf("# TODO%s", $message ? ' '.$message : '')); 432 $this->results['stats']['skipped'][] = $this-> test_nb;432 $this->results['stats']['skipped'][] = $this->nbTests; 433 433 array_pop($this->results['stats']['passed']); 434 434 } … … 442 442 * @return boolean 443 443 */ 444 public function include _ok($file, $message = '')444 public function includeOk($file, $message = '') 445 445 { 446 446 if (!$result = $this->ok((@include($file)) == 1, $message)) 447 447 { 448 $this->set _last_test_errors(array(sprintf(" Tried to include '%s'", $file)));448 $this->setLastTestErrors(array(sprintf(" Tried to include '%s'", $file))); 449 449 } 450 450 … … 452 452 } 453 453 454 private function test _is_deeply($var1, $var2)454 private function testIsDeeply($var1, $var2) 455 455 { 456 456 if (gettype($var1) != gettype($var2)) … … 470 470 return false; 471 471 } 472 $is _equal = true;472 $isEqual = true; 473 473 foreach ($var1 as $key => $value) 474 474 { 475 $is _equal = $this->test_is_deeply($var1[$key], $var2[$key]);476 if ($is _equal === false)475 $isEqual = $this->testIsDeeply($var1[$key], $var2[$key]); 476 if ($isEqual === false) 477 477 { 478 478 break; … … 480 480 } 481 481 482 return $is _equal;482 return $isEqual; 483 483 } 484 484 else … … 503 503 } 504 504 505 protected function update _stats()506 { 507 ++$this-> test_nb;505 protected function updateStats() 506 { 507 ++$this->nbTests; 508 508 ++$this->results['stats']['total']; 509 509 510 list($this->results['tests'][$this-> test_nb]['file'], $this->results['tests'][$this->test_nb]['line']) = $this->find_caller(debug_backtrace());511 } 512 513 protected function set _last_test_errors(array $errors)510 list($this->results['tests'][$this->nbTests]['file'], $this->results['tests'][$this->nbTests]['line']) = $this->findCaller(debug_backtrace()); 511 } 512 513 protected function setLastTestErrors(array $errors) 514 514 { 515 515 $this->output->diag($errors); 516 516 517 $this->results['tests'][$this-> test_nb]['error'] = implode("\n", $errors);518 } 519 520 protected function find _caller($traces)521 { 522 // find the first call to a method of an object that is an instance of lime_test517 $this->results['tests'][$this->nbTests]['error'] = implode("\n", $errors); 518 } 519 520 protected function findCaller($traces) 521 { 522 // find the first call to a method of an object that is an instance of sfLimeTest 523 523 $t = array_reverse($traces); 524 524 foreach ($t as $trace) 525 525 { 526 if (isset($trace['object']) && $trace['object'] instanceof lime_test)526 if (isset($trace['object']) && $trace['object'] instanceof sfLimeTest) 527 527 { 528 528 return array($trace['file'], $trace['line']); … … 541 541 } 542 542 543 class lime_output543 class sfLimeOutput 544 544 { 545 545 public $colorizer = null; 546 546 547 public function __construct($force _colors = false)548 { 549 $this->colorizer = new lime_colorizer($force_colors);547 public function __construct($forceColors = false) 548 { 549 $this->colorizer = new sfLimeColorizer($forceColors); 550 550 } 551 551 … … 571 571 public function error($message) 572 572 { 573 echo $this->colorizer->colorize(sprintf(' %s ', $message), ' RED_BAR')."\n";574 } 575 576 public function echoln($message, $colorizer _parameter = null, $colorize = true)573 echo $this->colorizer->colorize(sprintf(' %s ', $message), 'redBar')."\n"; 574 } 575 576 public function echoln($message, $colorizerParameter = null, $colorize = true) 577 577 { 578 578 if ($colorize) … … 584 584 } 585 585 586 echo ($colorizer _parameter ? $this->colorizer->colorize($message, $colorizer_parameter) : $message)."\n";587 } 588 589 public function green _bar($message)590 { 591 echo $this->colorizer->colorize($message.str_repeat(' ', 71 - min(71, strlen($message))), ' GREEN_BAR')."\n";592 } 593 594 public function red _bar($message)595 { 596 echo $this->colorizer->colorize($message.str_repeat(' ', 71 - min(71, strlen($message))), ' RED_BAR')."\n";586 echo ($colorizerParameter ? $this->colorizer->colorize($message, $colorizerParameter) : $message)."\n"; 587 } 588 589 public function greenBar($message) 590 { 591 echo $this->colorizer->colorize($message.str_repeat(' ', 71 - min(71, strlen($message))), 'greenBar')."\n"; 592 } 593 594 public function redBar($message) 595 { 596 echo $this->colorizer->colorize($message.str_repeat(' ', 71 - min(71, strlen($message))), 'redBar')."\n"; 597 597 } 598 598 } 599 599 600 class lime_output_color extends lime_output600 class sfLimeOutputColor extends sfLimeOutput 601 601 { 602 602 } 603 603 604 class lime_colorizer604 class sfLimeColorizer 605 605 { 606 606 static public $styles = array(); 607 607 608 protected $force _colors = false;609 610 public function __construct($force _colors = false)611 { 612 $this->force _colors = $force_colors;608 protected $forceColors = false; 609 610 public function __construct($forceColors = false) 611 { 612 $this->forceColors = $forceColors; 613 613 } 614 614 … … 621 621 { 622 622 // disable colors if not supported (windows or non tty console) 623 if (!$this->force _colors && (DIRECTORY_SEPARATOR == '\\' || !function_exists('posix_isatty') || !@posix_isatty(STDOUT)))623 if (!$this->forceColors && (DIRECTORY_SEPARATOR == '\\' || !function_exists('posix_isatty') || !@posix_isatty(STDOUT))) 624 624 { 625 625 return $text; … … 644 644 } 645 645 646 lime_colorizer::style('ERROR', array('bg' => 'red', 'fg' => 'white', 'bold' => true));647 lime_colorizer::style('INFO', array('fg' => 'green', 'bold' => true));648 lime_colorizer::style('PARAMETER', array('fg' => 'cyan'));649 lime_colorizer::style('COMMENT', array('fg' => 'yellow'));650 651 lime_colorizer::style('GREEN_BAR', array('fg' => 'white', 'bg' => 'green', 'bold' => true));652 lime_colorizer::style('RED_BAR', array('fg' => 'white', 'bg' => 'red', 'bold' => true));653 lime_colorizer::style('INFO_BAR', array('fg' => 'cyan', 'bold' => true));654 655 class lime_harness extends lime_registration646 sfLimeColorizer::style('ERROR', array('bg' => 'red', 'fg' => 'white', 'bold' => true)); 647 sfLimeColorizer::style('INFO', array('fg' => 'green', 'bold' => true)); 648 sfLimeColorizer::style('PARAMETER', array('fg' => 'cyan')); 649 sfLimeColorizer::style('COMMENT', array('fg' => 'yellow')); 650 651 sfLimeColorizer::style('greenBar', array('fg' => 'white', 'bg' => 'green', 'bold' => true)); 652 sfLimeColorizer::style('redBar', array('fg' => 'white', 'bg' => 'red', 'bold' => true)); 653 sfLimeColorizer::style('INFO_BAR', array('fg' => 'cyan', 'bold' => true)); 654 655 class sfLimeHarness extends sfLimeRegistration 656 656 { 657 657 public $options = array(); 658 public $ php_cli= null;658 public $executable = null; 659 659 public $stats = array(); 660 660 public $output = null; … … 669 669 670 670 $this->options = array_merge(array( 671 ' php_cli'=> null,671 'executable' => null, 672 672 'force_colors' => false, 673 673 'output' => null, … … 675 675 ), $options); 676 676 677 $this-> php_cli = $this->find_php_cli($this->options['php_cli']);678 $this->output = $this->options['output'] ? $this->options['output'] : new lime_output($this->options['force_colors']);679 } 680 681 protected function find _php_cli($php_cli= null)682 { 683 if (is_null($ php_cli))677 $this->executable = $this->findExecutable($this->options['executable']); 678 $this->output = $this->options['output'] ? $this->options['output'] : new sfLimeOutput($this->options['force_colors']); 679 } 680 681 protected function findExecutable($executable = null) 682 { 683 if (is_null($executable)) 684 684 { 685 685 if (getenv('PHP_PATH')) 686 686 { 687 $ php_cli= getenv('PHP_PATH');688 689 if (!is_executable($ php_cli))687 $executable = getenv('PHP_PATH'); 688 689 if (!is_executable($executable)) 690 690 { 691 691 throw new Exception('The defined PHP_PATH environment variable is not a valid PHP executable.'); … … 694 694 else 695 695 { 696 $ php_cli= PHP_BINDIR.DIRECTORY_SEPARATOR.'php';697 } 698 } 699 700 if (is_executable($ php_cli))701 { 702 return $ php_cli;696 $executable = PHP_BINDIR.DIRECTORY_SEPARATOR.'php'; 697 } 698 } 699 700 if (is_executable($executable)) 701 { 702 return $executable; 703 703 } 704 704 705 705 $path = getenv('PATH') ? getenv('PATH') : getenv('Path'); 706 $ex e_suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe', '.bat', '.cmd', '.com')) : array('');707 foreach (array('php5', 'php') as $ php_cli)708 { 709 foreach ($ex e_suffixes as $suffix)706 $extensions = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe', '.bat', '.cmd', '.com')) : array(''); 707 foreach (array('php5', 'php') as $executable) 708 { 709 foreach ($extensions as $extension) 710 710 { 711 711 foreach (explode(PATH_SEPARATOR, $path) as $dir) 712 712 { 713 $file = $dir.DIRECTORY_SEPARATOR.$ php_cli.$suffix;713 $file = $dir.DIRECTORY_SEPARATOR.$executable.$extension; 714 714 if (is_executable($file)) 715 715 { … … 723 723 } 724 724 725 public function to _array()725 public function toArray() 726 726 { 727 727 $results = array(); … … 734 734 } 735 735 736 public function to _xml()737 { 738 return lime_test::to_xml($this->to_array());736 public function toXml() 737 { 738 return sfLimeTest::toXml($this->toArray()); 739 739 } 740 740 … … 761 761 $stats = &$this->stats['files'][$file]; 762 762 763 $relative _file = $this->get_relative_file($file);764 765 $test _file = tempnam(sys_get_temp_dir(), 'lime');766 $result _file = tempnam(sys_get_temp_dir(), 'lime');767 file_put_contents($test _file, <<<EOF763 $relativeFile = $this->getRelativeFile($file); 764 765 $testFile = tempnam(sys_get_temp_dir(), 'lime'); 766 $resultFile = tempnam(sys_get_temp_dir(), 'lime'); 767 file_put_contents($testFile, <<<EOF 768 768 <?php 769 769 include('$file'); 770 file_put_contents('$result _file', serialize(lime_test::to_array()));770 file_put_contents('$resultFile', serialize(sfLimeTest::toArray())); 771 771 EOF 772 772 ); … … 774 774 ob_start(); 775 775 // see http://trac.symfony-project.org/ticket/5437 for the explanation on the weird "cd" thing 776 passthru(sprintf('cd & %s %s 2>&1', escapeshellarg($this-> php_cli), escapeshellarg($test_file)), $return);776 passthru(sprintf('cd & %s %s 2>&1', escapeshellarg($this->executable), escapeshellarg($testFile)), $return); 777 777 ob_end_clean(); 778 unlink($test _file);779 780 $output = file_get_contents($result _file);778 unlink($testFile); 779 780 $output = file_get_contents($resultFile); 781 781 $stats['output'] = $output ? unserialize($output) : ''; 782 782 if (!$stats['output']) … … 784 784 $stats['output'] = array(array('file' => $file, 'tests' => array(), 'stats' => array('plan' => 1, 'total' => 1, 'failed' => array(0), 'passed' => array(), 'skipped' => array()))); 785 785 } 786 unlink($result _file);787 788 $file _stats = &$stats['output'][0]['stats'];786 unlink($resultFile); 787 788 $fileStats = &$stats['output'][0]['stats']; 789 789 790 790 $delta = 0; … … 796 796 else 797 797 { 798 $this->stats['total'] += $file _stats['total'];799 800 if (!$file _stats['plan'])801 { 802 $file _stats['plan'] = $file_stats['total'];803 } 804 805 $delta = $file _stats['plan'] - $file_stats['total'];798 $this->stats['total'] += $fileStats['total']; 799 800 if (!$fileStats['plan']) 801 { 802 $fileStats['plan'] = $fileStats['total']; 803 } 804 805 $delta = $fileStats['plan'] - $fileStats['total']; 806 806 if (0 != $delta) 807 807 { … … 811 811 else 812 812 { 813 $stats['status'] = $file _stats['failed'] ? 'not ok' : 'ok';813 $stats['status'] = $fileStats['failed'] ? 'not ok' : 'ok'; 814 814 $stats['status_code'] = 0; 815 815 } 816 816 } 817 817 818 $this->output->echoln(sprintf('%s%s%s', substr($relative _file, -min(67, strlen($relative_file))), str_repeat('.', 70 - min(67, strlen($relative_file))), $stats['status']));818 $this->output->echoln(sprintf('%s%s%s', substr($relativeFile, -min(67, strlen($relativeFile))), str_repeat('.', 70 - min(67, strlen($relativeFile))), $stats['status'])); 819 819 820 820 if (0 != $stats['status_code']) … … 830 830 if ($delta > 0) 831 831 { 832 $this->output->echoln(sprintf(' Looks like you planned %d tests but only ran %d.', $file _stats['plan'], $file_stats['total']));832 $this->output->echoln(sprintf(' Looks like you planned %d tests but only ran %d.', $fileStats['plan'], $fileStats['total'])); 833 833 834 834 $this->stats['failed_tests'] += $delta; … … 837 837 else if ($delta < 0) 838 838 { 839 $this->output->echoln(sprintf(' Looks like you planned %s test but ran %s extra.', $file _stats['plan'], $file_stats['total'] - $file_stats['plan']));840 } 841 842 if (false !== $file _stats && $file_stats['failed'])843 { 844 $this->stats['failed_tests'] += count($file _stats['failed']);845 846 $this->output->echoln(sprintf(" Failed tests: %s", implode(', ', $file _stats['failed'])));839 $this->output->echoln(sprintf(' Looks like you planned %s test but ran %s extra.', $fileStats['plan'], $fileStats['total'] - $fileStats['plan'])); 840 } 841 842 if (false !== $fileStats && $fileStats['failed']) 843 { 844 $this->stats['failed_tests'] += count($fileStats['failed']); 845 846 $this->output->echoln(sprintf(" Failed tests: %s", implode(', ', $fileStats['failed']))); 847 847 } 848 848 } … … 859 859 continue; 860 860 } 861 $relative _file = $this->get_relative_file($file);861 $relativeFile = $this->getRelativeFile($file); 862 862 863 863 if (isset($stat['output'][0])) 864 864 { 865 $this->output->echoln(sprintf($format, substr($relative _file, -min(30, strlen($relative_file))), $stat['status_code'], count($stat['output'][0]['stats']['failed']) + count($stat['output'][0]['stats']['passed']), count($stat['output'][0]['stats']['failed']), implode(' ', $stat['output'][0]['stats']['failed'])));865 $this->output->echoln(sprintf($format, substr($relativeFile, -min(30, strlen($relativeFile))), $stat['status_code'], count($stat['output'][0]['stats']['failed']) + count($stat['output'][0]['stats']['passed']), count($stat['output'][0]['stats']['failed']), implode(' ', $stat['output'][0]['stats']['failed']))); 866 866 } 867 867 else 868 868 { 869 $this->output->echoln(sprintf($format, substr($relative _file, -min(30, strlen($relative_file))), $stat['status_code'], '', '', ''));870 } 871 } 872 873 $this->output->red _bar(sprintf('Failed %d/%d test scripts, %.2f%% okay. %d/%d subtests failed, %.2f%% okay.',874 $nb _failed_files = count($this->stats['failed_files']),875 $nb _files = count($this->files),876 ($nb _files - $nb_failed_files) * 100 / $nb_files,877 $nb _failed_tests = $this->stats['failed_tests'],878 $nb _tests = $this->stats['total'],879 $nb _tests > 0 ? ($nb_tests - $nb_failed_tests) * 100 / $nb_tests : 0869 $this->output->echoln(sprintf($format, substr($relativeFile, -min(30, strlen($relativeFile))), $stat['status_code'], '', '', '')); 870 } 871 } 872 873 $this->output->redBar(sprintf('Failed %d/%d test scripts, %.2f%% okay. %d/%d subtests failed, %.2f%% okay.', 874 $nbFailedFiles = count($this->stats['failed_files']), 875 $nbFiles = count($this->files), 876 ($nbFiles - $nbFailedFiles) * 100 / $nbFiles, 877 $nbFailedTests = $this->stats['failed_tests'], 878 $nbTests = $this->stats['total'], 879 $nbTests > 0 ? ($nbTests - $nbFailedTests) * 100 / $nbTests : 0 880 880 )); 881 881 882 882 if ($this->options['verbose']) 883 883 { 884 foreach ($this->to _array() as $testsuite)884 foreach ($this->toArray() as $testSuite) 885 885 { 886 886 $first = true; 887 foreach ($test suite['stats']['failed'] as $testcase)887 foreach ($testSuite['stats']['failed'] as $testCase) 888 888 { 889 if (!isset($test suite['tests'][$testcase]['file']))889 if (!isset($testSuite['tests'][$testCase]['file'])) 890 890 { 891 891 continue; … … 895 895 { 896 896 $this->output->echoln(''); 897 $this->output->error($test suite['file']);897 $this->output->error($testSuite['file']); 898 898 $first = false; 899 899 } 900 900 901 $this->output->comment(sprintf(' at %s line %s', $test suite['tests'][$testcase]['file'], $testsuite['tests'][$testcase]['line']));902 $this->output->info(' '.$test suite['tests'][$testcase]['message']);903 $this->output->echoln($test suite['tests'][$testcase]['error'], null, false);901 $this->output->comment(sprintf(' at %s line %s', $testSuite['tests'][$testCase]['file'], $testSuite['tests'][$testCase]['line'])); 902 $this->output->info(' '.$testSuite['tests'][$testCase]['message']); 903 $this->output->echoln($testSuite['tests'][$testCase]['error'], null, false); 904 904 } 905 905 } … … 908 908 else 909 909 { 910 $this->output->green _bar(' All tests successful.');911 $this->output->green _bar(sprintf(' Files=%d, Tests=%d', count($this->files), $this->stats['total']));910 $this->output->greenBar(' All tests successful.'); 911 $this->output->greenBar(sprintf(' Files=%d, Tests=%d', count($this->files), $this->stats['total'])); 912 912 } 913 913 … … 915 915 } 916 916 917 public function get _failed_files()917 public function getFailedFiles() 918 918 { 919 919 return isset($this->stats['failed_files']) ? $this->stats['failed_files'] : array(); … … 921 921 } 922 922 923 class lime_coverage extends lime_registration923 class sfLimeCoverage extends sfLimeRegistration 924 924 { 925 925 public $files = array(); 926 926 public $extension = '.php'; 927 public $base _dir = '';927 public $baseDir = ''; 928 928 public $harness = null; 929 929 public $verbose = false; … … 971 971 } 972 972 973 $tmp _file = sys_get_temp_dir().DIRECTORY_SEPARATOR.'test.php';973 $tmpFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.'test.php'; 974 974 foreach ($files as $file) 975 975 { … … 980 980 echo '<PHP_SER>'.serialize(xdebug_get_code_coverage()).'</PHP_SER>'; 981 981 EOF; 982 file_put_contents($tmp _file, $tmp);982 file_put_contents($tmpFile, $tmp); 983 983 ob_start(); 984 984 // see http://trac.symfony-project.org/ticket/5437 for the explanation on the weird "cd" thing 985 passthru(sprintf('cd & %s %s 2>&1', escapeshellarg($this->harness-> php_cli), escapeshellarg($tmp_file)), $return);985 passthru(sprintf('cd & %s %s 2>&1', escapeshellarg($this->harness->executable), escapeshellarg($tmpFile)), $return); 986 986 $retval = ob_get_clean(); 987 987 … … 1028 1028 } 1029 1029 1030 if (file_exists($tmp _file))1031 { 1032 unlink($tmp _file);1030 if (file_exists($tmpFile)) 1031 { 1032 unlink($tmpFile); 1033 1033 } 1034 1034 } … … 1037 1037 { 1038 1038 ksort($this->coverage); 1039 $total _php_lines = 0;1040 $total _covered_lines = 0;1039 $totalPhpLines = 0; 1040 $totalCoveredLines = 0; 1041 1041 foreach ($files as $file) 1042 1042 { 1043 1043 $file = realpath($file); 1044 $is _covered = isset($this->coverage[$file]);1044 $isCovered = isset($this->coverage[$file]); 1045 1045 $cov = isset($this->coverage[$file]) ? $this->coverage[$file] : array(); 1046 $covered _lines = array();1047 $missing _lines = array();1046 $coveredLines = array(); 1047 $missingLines = array(); 1048 1048 1049 1049 foreach ($cov as $line => $flag) … … 1052 1052 { 1053 1053 case 1: 1054 $covered _lines[] = $line;1054 $coveredLines[] = $line; 1055 1055 break; 1056 1056 case -1: 1057 $missing _lines[] = $line;1057 $missingLines[] = $line; 1058 1058 break; 1059 1059 } 1060 1060 } 1061 1061 1062 $total _lines = count($covered_lines) + count($missing_lines);1063 if (!$total _lines)1062 $totalLines = count($coveredLines) + count($missingLines); 1063 if (!$totalLines) 1064 1064 { 1065 1065 // probably means that the file is not covered at all! 1066 $total _lines = count($this->get_php_lines(file_get_contents($file)));1066 $totalLines = count($this->getPhpLines(file_get_contents($file))); 1067 1067 } 1068 1068 1069 1069 $output = $this->harness->output; 1070 $percent = $total _lines ? count($covered_lines) * 100 / $total_lines : 0;1071 1072 $total _php_lines += $total_lines;1073 $total _covered_lines += count($covered_lines);1074 1075 $relative _file = $this->get_relative_file($file);1076 $output->echoln(sprintf("%-70s %3.0f%%", substr($relative _file, -min(70, strlen($relative_file))), $percent), $percent == 100 ? 'INFO' : ($percent > 90 ? 'PARAMETER' : ($percent < 20 ? 'ERROR' : '')));1077 if ($this->verbose && $is _covered && $percent != 100)1078 { 1079 $output->comment(sprintf("missing: %s", $this->format _range($missing_lines)));1080 } 1081 } 1082 1083 $output->echoln(sprintf("TOTAL COVERAGE: %3.0f%%", $total _php_lines ? $total_covered_lines * 100 / $total_php_lines : 0));1084 } 1085 1086 public static function get _php_lines($content)1070 $percent = $totalLines ? count($coveredLines) * 100 / $totalLines : 0; 1071 1072 $totalPhpLines += $totalLines; 1073 $totalCoveredLines += count($coveredLines); 1074 1075 $relativeFile = $this->getRelativeFile($file); 1076 $output->echoln(sprintf("%-70s %3.0f%%", substr($relativeFile, -min(70, strlen($relativeFile))), $percent), $percent == 100 ? 'INFO' : ($percent > 90 ? 'PARAMETER' : ($percent < 20 ? 'ERROR' : ''))); 1077 if ($this->verbose && $isCovered && $percent != 100) 1078 { 1079 $output->comment(sprintf("missing: %s", $this->formatRange($missingLines))); 1080 } 1081 } 1082 1083 $output->echoln(sprintf("TOTAL COVERAGE: %3.0f%%", $totalPhpLines ? $totalCoveredLines * 100 / $totalPhpLines : 0)); 1084 } 1085 1086 public static function getPhpLines($content) 1087 1087 { 1088 1088 if (is_readable($content)) … … 1092 1092 1093 1093 $tokens = token_get_all($content); 1094 $php _lines = array();1095 $current _line = 1;1096 $in _class = false;1097 $in _function = false;1098 $in _function_declaration = false;1099 $end _of_current_expr = true;1100 $open _braces = 0;1094 $phpLines = array(); 1095 $currentLine = 1; 1096 $inClass = false; 1097 $inFunction = false; 1098 $inFunctionDeclaration = false; 1099 $endOfCurrentExpr = true; 1100 $openBraces = 0; 1101 1101 foreach ($tokens as $token) 1102 1102 { … … 1106 1106 { 1107 1107 case '=': 1108 if (false === $in _class || (false !== $in_function && !$in_function_declaration))1108 if (false === $inClass || (false !== $inFunction && !$inFunctionDeclaration)) 1109 1109 { 1110 $php _lines[$current_line] = true;1110 $phpLines[$currentLine] = true; 1111 1111 } 1112 1112 break; 1113 1113 case '{': 1114 ++$open _braces;1115 $in _function_declaration = false;1114 ++$openBraces; 1115 $inFunctionDeclaration = false; 1116 1116 break; 1117 1117 case ';': 1118 $in _function_declaration = false;1119 $end _of_current_expr = true;1118 $inFunctionDeclaration = false; 1119 $endOfCurrentExpr = true; 1120 1120 break; 1121 1121 case '}': 1122 $end _of_current_expr = true;1123 --$open _braces;1124 if ($open _braces == $in_class)1122 $endOfCurrentExpr = true; 1123 --$openBraces; 1124 if ($openBraces == $inClass) 1125 1125 { 1126 $in _class = false;1126 $inClass = false; 1127 1127 } 1128 if ($open _braces == $in_function)1128 if ($openBraces == $inFunction) 1129 1129 { 1130 $in _function = false;1130 $inFunction = false; 1131 1131 } 1132 1132 break; … … 1142 1142 case T_CURLY_OPEN: 1143 1143 case T_DOLLAR_OPEN_CURLY_BRACES: 1144 ++$open _braces;1144 ++$openBraces; 1145 1145 break; 1146 1146 case T_WHITESPACE: 1147 1147 case T_OPEN_TAG: 1148 1148 case T_CLOSE_TAG: 1149 $end _of_current_expr = true;1150 $current _line += count(explode("\n", $text)) - 1;1149 $endOfCurrentExpr = true; 1150 $currentLine += count(explode("\n", $text)) - 1; 1151 1151 break; 1152 1152 case T_COMMENT: 1153 1153 case T_DOC_COMMENT: 1154 $current _line += count(explode("\n", $text)) - 1;1154 $currentLine += count(explode("\n", $text)) - 1; 1155 1155 break; 1156 1156 case T_CLASS: 1157 $in _class = $open_braces;1157 $inClass = $openBraces; 1158 1158 break; 1159 1159 case T_FUNCTION: 1160 $in _function = $open_braces;1161 $in _function_declaration = true;1160 $inFunction = $openBraces; 1161 $inFunctionDeclaration = true; 1162 1162 break; 1163 1163 case T_AND_EQUAL: … … 1226 1226 case T_WHILE: 1227 1227 case T_XOR_EQUAL: 1228 $php _lines[$current_line] = true;1229 $end _of_current_expr = false;1228 $phpLines[$currentLine] = true; 1229 $endOfCurrentExpr = false; 1230 1230 break; 1231 1231 default: 1232 if (false === $end _of_current_expr)1232 if (false === $endOfCurrentExpr) 1233 1233 { 1234 $php _lines[$current_line] = true;1234 $phpLines[$currentLine] = true; 1235 1235 } 1236 1236 } 1237 1237 } 1238 1238 1239 return $php _lines;1239 return $phpLines; 1240 1240 } 1241 1241 1242 1242 public function compute($content, $cov) 1243 1243 { 1244 $php _lines = self::get_php_lines($content);1244 $phpLines = self::getPhpLines($content); 1245 1245 1246 1246 // we remove from $cov non php lines 1247 foreach (array_diff_key($cov, $php _lines) as $line => $tmp)1247 foreach (array_diff_key($cov, $phpLines) as $line => $tmp) 1248 1248 { 1249 1249 unset($cov[$line]); 1250 1250 } 1251 1251 1252 return array($cov, $php _lines);1253 } 1254 1255 public function format _range($lines)1252 return array($cov, $phpLines); 1253 } 1254 1255 public function formatRange($lines) 1256 1256 { 1257 1257 sort($lines); … … 1284 1284 } 1285 1285 1286 class lime_registration1286 class sfLimeRegistration 1287 1287 { 1288 1288 public $files = array(); 1289 1289 public $extension = '.php'; 1290 public $base _dir = '';1291 1292 public function register($files _or_directories)1293 { 1294 foreach ((array) $files _or_directories as $f_or_d)1295 { 1296 if (is_file($f _or_d))1297 { 1298 $this->files[] = realpath($f _or_d);1299 } 1300 elseif (is_dir($f _or_d))1301 { 1302 $this->register _dir($f_or_d);1290 public $baseDir = ''; 1291 1292 public function register($filesOrDirectories) 1293 { 1294 foreach ((array) $filesOrDirectories as $fileOrDirectory) 1295 { 1296 if (is_file($fileOrDirectory)) 1297 { 1298 $this->files[] = realpath($fileOrDirectory); 1299 } 1300 elseif (is_dir($fileOrDirectory)) 1301 { 1302 $this->registerDir($fileOrDirectory); 1303 1303 } 1304 1304 else 1305 1305 { 1306 throw new Exception(sprintf('The file or directory "%s" does not exist.', $f _or_d));1307 } 1308 } 1309 } 1310 1311 public function register _glob($glob)1306 throw new Exception(sprintf('The file or directory "%s" does not exist.', $fileOrDirectory)); 1307 } 1308 } 1309 } 1310 1311 public function registerGlob($glob) 1312 1312 { 1313 1313 if ($dirs = glob($glob)) … … 1320 1320 } 1321 1321 1322 public function register _dir($directory)1322 public function registerDir($directory) 1323 1323 { 1324 1324 if (!is_dir($directory)) … … 1329 1329 $files = array(); 1330 1330 1331 $current _dir = opendir($directory);1332 while ($entry = readdir($current _dir))1331 $currentDir = opendir($directory); 1332 while ($entry = readdir($currentDir)) 1333 1333 { 1334 1334 if ($entry == '.' || $entry == '..') continue; … … 1336 1336 if (is_dir($entry)) 1337 1337 { 1338 $this->register _dir($entry);1338 $this->registerDir($entry); 1339 1339 } 1340 1340 elseif (preg_match('#'.$this->extension.'$#', $entry)) … … 1347 1347 } 1348 1348 1349 protected function get _relative_file($file)1350 { 1351 return str_replace(DIRECTORY_SEPARATOR, '/', str_replace(array(realpath($this->base _dir).DIRECTORY_SEPARATOR, $this->extension), '', $file));1349 protected function getRelativeFile($file) 1350 { 1351 return str_replace(DIRECTORY_SEPARATOR, '/', str_replace(array(realpath($this->baseDir).DIRECTORY_SEPARATOR, $this->extension), '', $file)); 1352 1352 } 1353 1353 } tools/lime/branches/2.0-experimental/tests/phpt/lime_test/can_ok.phpt
r19496 r19882 1 1 --TEST-- 2 can_okmethod2 hasMethod method 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 6 class Test { function test() {} } 7 $t-> can_ok(new Test(), 'test');7 $t->hasMethod(new Test(), 'test'); 8 8 ?> 9 9 --EXPECT-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/can_ok_fails.phpt
r19498 r19882 1 1 --TEST-- 2 can_okmethod that fails2 hasMethod method that fails 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 6 class Test { function test() {} } 7 $t-> can_ok(new Test(), 'foo');7 $t->hasMethod(new Test(), 'foo'); 8 8 ?> 9 9 --EXPECTF-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/can_ok_name.phpt
r19496 r19882 1 1 --TEST-- 2 can_okmethod with test name2 hasMethod method with test name 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 6 class Test { function test() {} } 7 $t-> can_ok(new Test(), 'test', 'test name');7 $t->hasMethod(new Test(), 'test', 'test name'); 8 8 ?> 9 9 --EXPECT-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/cmp_ok.phpt
r19496 r19882 1 1 --TEST-- 2 c mp_okmethod2 compare method 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 $t->c mp_ok(2, '>', 1);6 $t->compare(2, '>', 1); 7 7 ?> 8 8 --EXPECT-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/cmp_ok_fails.phpt
r19498 r19882 1 1 --TEST-- 2 c mp_okmethod that fails2 compare method that fails 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 $t->c mp_ok(1, '>', 1);6 $t->compare(1, '>', 1); 7 7 ?> 8 8 --EXPECTF-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/cmp_ok_name.phpt
r19496 r19882 1 1 --TEST-- 2 c mp_okmethod with test name2 compare method with test name 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 $t->c mp_ok(2, '>', 1, 'test name');6 $t->compare(2, '>', 1, 'test name'); 7 7 ?> 8 8 --EXPECT-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/include_ok.phpt
r19496 r19882 1 1 --TEST-- 2 include _ok method2 includeOk method 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 $t->include _ok(dirname(__FILE__).'/include_test.php');6 $t->includeOk(dirname(__FILE__).'/include_test.php'); 7 7 ?> 8 8 --EXPECT-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/include_ok_fails.phpt
r19498 r19882 1 1 --TEST-- 2 include _ok method that fails2 includeOk method that fails 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 $t->include _ok('foo.php');6 $t->includeOk('foo.php'); 7 7 ?> 8 8 --EXPECTF-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/include_ok_name.phpt
r19496 r19882 1 1 --TEST-- 2 include _ok method with test name2 includeOk method with test name 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 $t->include _ok(dirname(__FILE__).'/include_test.php', 'test name');6 $t->includeOk(dirname(__FILE__).'/include_test.php', 'test name'); 7 7 ?> 8 8 --EXPECT-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/is_deeply.phpt
r19496 r19882 1 1 --TEST-- 2 is _deeply method2 isDeeply method 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 $t->is _deeply(array(1, 2, array(1 => 'foo', 'a' => '4')), array(1, 2, array(1 => 'foo', 'a' => '4')));6 $t->isDeeply(array(1, 2, array(1 => 'foo', 'a' => '4')), array(1, 2, array(1 => 'foo', 'a' => '4'))); 7 7 ?> 8 8 --EXPECT-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/is_deeply_fails.phpt
r19498 r19882 1 1 --TEST-- 2 is _deeply method that fails2 isDeeply method that fails 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 $t->is _deeply(array(1, 2, array(1 => 'foo', 'a' => '4')), array(1, 2, array(1 => 'bar', 'a' => '4')));7 $t->is _deeply(array(1, 2, 3), array());8 $t->is _deeply(array(), array(1, 2, 3));6 $t->isDeeply(array(1, 2, array(1 => 'foo', 'a' => '4')), array(1, 2, array(1 => 'bar', 'a' => '4'))); 7 $t->isDeeply(array(1, 2, 3), array()); 8 $t->isDeeply(array(), array(1, 2, 3)); 9 9 ?> 10 10 --EXPECTF-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/is_deeply_name.phpt
r19496 r19882 1 1 --TEST-- 2 is _deeply method with test name2 isDeeply method with test name 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 $t->is _deeply(array(1, 2, array(1 => 'foo', 'a' => '4')), array(1, 2, array(1 => 'foo', 'a' => '4')), 'test name');6 $t->isDeeply(array(1, 2, array(1 => 'foo', 'a' => '4')), array(1, 2, array(1 => 'foo', 'a' => '4')), 'test name'); 7 7 ?> 8 8 --EXPECT-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/isa_ok.phpt
r19496 r19882 1 1 --TEST-- 2 isa _okmethod2 isa method 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 6 class Test {} 7 $t->isa _ok(new Test(), 'Test');7 $t->isa(new Test(), 'Test'); 8 8 ?> 9 9 --EXPECT-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/isa_ok_fails.phpt
r19498 r19882 1 1 --TEST-- 2 isa _okmethod that fails2 isa method that fails 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 6 class Test {} 7 $t->isa _ok(new Test(), 'Foo');7 $t->isa(new Test(), 'Foo'); 8 8 ?> 9 9 --EXPECTF-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/isa_ok_name.phpt
r19496 r19882 1 1 --TEST-- 2 isa _okmethod with test name2 isa method with test name 3 3 --FILE-- 4 4 <?php 5 5 require_once(dirname(__FILE__).'/setup.php'); 6 6 class Test {} 7 $t->isa _ok(new Test(), 'Test', 'test name');7 $t->isa(new Test(), 'Test', 'test name'); 8 8 ?> 9 9 --EXPECT-- tools/lime/branches/2.0-experimental/tests/phpt/lime_test/setup.php
r19496 r19882 2 2 3 3 require_once(dirname(__FILE__).'/../../../lib/lime.php'); 4 $t = new lime_test();4 $t = new sfLimeTest();

