Development

Changeset 19882

You must first sign up to be able to contribute.

Changeset 19882

Show
Ignore:
Timestamp:
07/05/09 09:51:53 (7 months ago)
Author:
bschussek
Message:

Adapted symfony coding conventions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/lime/branches/2.0-experimental/lib/lime.php

    r19872 r19882  
    1616 * @version    SVN: $Id$ 
    1717 */ 
    18 class lime_test 
     18class sfLimeTest 
    1919{ 
    2020  const EPSILON = 0.0000000001; 
    2121 
    22   protected $test_nb = 0; 
     22  protected $nbTests = 0; 
    2323  protected $output  = null; 
    2424  protected $results = array(); 
    2525  protected $options = array(); 
    2626 
    27   static protected $all_results = array(); 
     27  static protected $allResults = array(); 
    2828 
    2929  public function __construct($plan = null, $options = array()) 
     
    4242    ), $options); 
    4343 
    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']); 
    4545    $this->options['base_dir'] = realpath($this->options['base_dir']); 
    4646 
    47     $caller = $this->find_caller(debug_backtrace()); 
    48     self::$all_results[] = array( 
     47    $caller = $this->findCaller(debug_backtrace()); 
     48    self::$allResults[] = array( 
    4949      'file'  => $caller[0], 
    5050      'tests' => array(), 
     
    5252    ); 
    5353 
    54     $this->results = &self::$all_results[count(self::$all_results) - 1]; 
     54    $this->results = &self::$allResults[count(self::$allResults) - 1]; 
    5555 
    5656    null !== $plan and $this->output->echoln(sprintf("1..%d", $plan)); 
     
    5959  static public function reset() 
    6060  { 
    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) 
    7070  { 
    7171    if (is_null($results)) 
    7272    { 
    73       $results = self::$all_results; 
     73      $results = self::$allResults; 
    7474    } 
    7575 
     
    8686    foreach ($results as $result) 
    8787    { 
    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']); 
     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']); 
    9696 
    9797      $failures += count($result['stats']['failed']); 
     
    101101      foreach ($result['tests'] as $test) 
    102102      { 
    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); 
     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); 
    108108        if (!$test['status']) 
    109109        { 
    110           $testcase->appendChild($failure = $dom->createElement('failure')); 
     110          $testCase->appendChild($failure = $dom->createElement('failure')); 
    111111          $failure->setAttribute('type', 'lime'); 
    112112          if ($test['error']) 
     
    137137    if ($total > $plan) 
    138138    { 
    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)); 
    140140    } 
    141141    elseif ($total < $plan) 
    142142    { 
    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)); 
    144144    } 
    145145 
    146146    if ($failed) 
    147147    { 
    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)); 
    149149    } 
    150150    else if ($total == $plan) 
    151151    { 
    152       $this->output->green_bar(" Looks like everything went fine."); 
     152      $this->output->greenBar(" Looks like everything went fine."); 
    153153    } 
    154154 
     
    166166  public function ok($exp, $message = '') 
    167167  { 
    168     $this->update_stats(); 
     168    $this->updateStats(); 
    169169 
    170170    if ($result = (boolean) $exp) 
    171171    { 
    172       $this->results['stats']['passed'][] = $this->test_nb
     172      $this->results['stats']['passed'][] = $this->nbTests
    173173    } 
    174174    else 
    175175    { 
    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) : '')); 
    181181 
    182182    if (!$result) 
    183183    { 
    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'])); 
    185185    } 
    186186 
     
    214214    if (!$result = $this->ok($value, $message)) 
    215215    { 
    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)))); 
    217217    } 
    218218 
     
    233233    if (!$result = $this->ok($exp1 != $exp2, $message)) 
    234234    { 
    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)))); 
    236236    } 
    237237 
     
    252252    if (!$result = $this->ok(preg_match($regex, $exp), $message)) 
    253253    { 
    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))); 
    255255    } 
    256256 
     
    271271    if (!$result = $this->ok(!preg_match($regex, $exp), $message)) 
    272272    { 
    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))); 
    274274    } 
    275275 
     
    287287   * @return boolean 
    288288   */ 
    289   public function cmp_ok($exp1, $op, $exp2, $message = '') 
     289  public function compare($exp1, $op, $exp2, $message = '') 
    290290  { 
    291291    eval(sprintf("\$result = \$exp1 $op \$exp2;")); 
    292292    if (!$this->ok($result, $message)) 
    293293    { 
    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))))); 
    295295    } 
    296296 
     
    307307   * @return boolean 
    308308   */ 
    309   public function can_ok($object, $methods, $message = '') 
     309  public function hasMethod($object, $methods, $message = '') 
    310310  { 
    311311    $result = true; 
    312     $failed_messages = array(); 
     312    $failedMessages = array(); 
    313313    foreach ((array) $methods as $method) 
    314314    { 
    315315      if (!method_exists($object, $method)) 
    316316      { 
    317         $failed_messages[] = sprintf("      method '%s' does not exist", $method); 
     317        $failedMessages[] = sprintf("      method '%s' does not exist", $method); 
    318318        $result = false; 
    319319      } 
     
    322322    !$this->ok($result, $message); 
    323323 
    324     !$result and $this->set_last_test_errors($failed_messages); 
     324    !$result and $this->setLastTestErrors($failedMessages); 
    325325 
    326326    return $result; 
     
    336336   * @return boolean 
    337337   */ 
    338   public function isa_ok($var, $class, $message = '') 
     338  public function isa($var, $class, $message = '') 
    339339  { 
    340340    $type = is_object($var) ? get_class($var) : gettype($var); 
    341341    if (!$result = $this->ok($type == $class, $message)) 
    342342    { 
    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))); 
    344344    } 
    345345 
     
    356356   * @return boolean 
    357357   */ 
    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))))); 
    363363    } 
    364364 
     
    403403 
    404404  /** 
    405    * Counts as $nb_tests tests--useful for conditional tests 
     405   * Counts as $nbTests tests--useful for conditional tests 
    406406   * 
    407407   * @param string  $message  display output message 
    408    * @param integer $nb_tests number of tests to skip 
     408   * @param integer $nbTests number of tests to skip 
    409409   * 
    410410   * @return void 
    411411   */ 
    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++) 
    415415    { 
    416416      $this->pass(sprintf("# SKIP%s", $message ? ' '.$message : '')); 
    417       $this->results['stats']['skipped'][] = $this->test_nb
     417      $this->results['stats']['skipped'][] = $this->nbTests
    418418      array_pop($this->results['stats']['passed']); 
    419419    } 
     
    430430  { 
    431431    $this->pass(sprintf("# TODO%s", $message ? ' '.$message : '')); 
    432     $this->results['stats']['skipped'][] = $this->test_nb
     432    $this->results['stats']['skipped'][] = $this->nbTests
    433433    array_pop($this->results['stats']['passed']); 
    434434  } 
     
    442442   * @return boolean 
    443443   */ 
    444   public function include_ok($file, $message = '') 
     444  public function includeOk($file, $message = '') 
    445445  { 
    446446    if (!$result = $this->ok((@include($file)) == 1, $message)) 
    447447    { 
    448       $this->set_last_test_errors(array(sprintf("      Tried to include '%s'", $file))); 
     448      $this->setLastTestErrors(array(sprintf("      Tried to include '%s'", $file))); 
    449449    } 
    450450 
     
    452452  } 
    453453 
    454   private function test_is_deeply($var1, $var2) 
     454  private function testIsDeeply($var1, $var2) 
    455455  { 
    456456    if (gettype($var1) != gettype($var2)) 
     
    470470        return false; 
    471471      } 
    472       $is_equal = true; 
     472      $isEqual = true; 
    473473      foreach ($var1 as $key => $value) 
    474474      { 
    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) 
    477477        { 
    478478          break; 
     
    480480      } 
    481481 
    482       return $is_equal; 
     482      return $isEqual; 
    483483    } 
    484484    else 
     
    503503  } 
    504504 
    505   protected function update_stats() 
    506   { 
    507     ++$this->test_nb
     505  protected function updateStats() 
     506  { 
     507    ++$this->nbTests
    508508    ++$this->results['stats']['total']; 
    509509 
    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) 
    514514  { 
    515515    $this->output->diag($errors); 
    516516 
    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_test 
     517    $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 
    523523    $t = array_reverse($traces); 
    524524    foreach ($t as $trace) 
    525525    { 
    526       if (isset($trace['object']) && $trace['object'] instanceof lime_test) 
     526      if (isset($trace['object']) && $trace['object'] instanceof sfLimeTest) 
    527527      { 
    528528        return array($trace['file'], $trace['line']); 
     
    541541} 
    542542 
    543 class lime_output 
     543class sfLimeOutput 
    544544{ 
    545545  public $colorizer = null; 
    546546 
    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); 
    550550  } 
    551551 
     
    571571  public function error($message) 
    572572  { 
    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) 
    577577  { 
    578578    if ($colorize) 
     
    584584    } 
    585585 
    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"; 
    597597  } 
    598598} 
    599599 
    600 class lime_output_color extends lime_output 
     600class sfLimeOutputColor extends sfLimeOutput 
    601601{ 
    602602} 
    603603 
    604 class lime_colorizer 
     604class sfLimeColorizer 
    605605{ 
    606606  static public $styles = array(); 
    607607 
    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; 
    613613  } 
    614614 
     
    621621  { 
    622622    // 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))) 
    624624    { 
    625625      return $text; 
     
    644644} 
    645645 
    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_registration 
     646sfLimeColorizer::style('ERROR', array('bg' => 'red', 'fg' => 'white', 'bold' => true)); 
     647sfLimeColorizer::style('INFO', array('fg' => 'green', 'bold' => true)); 
     648sfLimeColorizer::style('PARAMETER', array('fg' => 'cyan')); 
     649sfLimeColorizer::style('COMMENT', array('fg' => 'yellow')); 
     650 
     651sfLimeColorizer::style('greenBar', array('fg' => 'white', 'bg' => 'green', 'bold' => true)); 
     652sfLimeColorizer::style('redBar', array('fg' => 'white', 'bg' => 'red', 'bold' => true)); 
     653sfLimeColorizer::style('INFO_BAR', array('fg' => 'cyan', 'bold' => true)); 
     654 
     655class sfLimeHarness extends sfLimeRegistration 
    656656{ 
    657657  public $options = array(); 
    658   public $php_cli = null; 
     658  public $executable = null; 
    659659  public $stats   = array(); 
    660660  public $output  = null; 
     
    669669 
    670670    $this->options = array_merge(array( 
    671       'php_cli'      => null, 
     671      'executable'   => null, 
    672672      'force_colors' => false, 
    673673      'output'       => null, 
     
    675675    ), $options); 
    676676 
    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)) 
    684684    { 
    685685      if (getenv('PHP_PATH')) 
    686686      { 
    687         $php_cli = getenv('PHP_PATH'); 
    688  
    689         if (!is_executable($php_cli)) 
     687        $executable = getenv('PHP_PATH'); 
     688 
     689        if (!is_executable($executable)) 
    690690        { 
    691691          throw new Exception('The defined PHP_PATH environment variable is not a valid PHP executable.'); 
     
    694694      else 
    695695      { 
    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
    703703    } 
    704704 
    705705    $path = getenv('PATH') ? getenv('PATH') : getenv('Path'); 
    706     $exe_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 ($exe_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
    710710      { 
    711711        foreach (explode(PATH_SEPARATOR, $path) as $dir) 
    712712        { 
    713           $file = $dir.DIRECTORY_SEPARATOR.$php_cli.$suffix
     713          $file = $dir.DIRECTORY_SEPARATOR.$executable.$extension
    714714          if (is_executable($file)) 
    715715          { 
     
    723723  } 
    724724 
    725   public function to_array() 
     725  public function toArray() 
    726726  { 
    727727    $results = array(); 
     
    734734  } 
    735735 
    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()); 
    739739  } 
    740740 
     
    761761      $stats = &$this->stats['files'][$file]; 
    762762 
    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, <<<EOF 
     763      $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 
    768768<?php 
    769769include('$file'); 
    770 file_put_contents('$result_file', serialize(lime_test::to_array())); 
     770file_put_contents('$resultFile', serialize(sfLimeTest::toArray())); 
    771771EOF 
    772772      ); 
     
    774774      ob_start(); 
    775775      // 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); 
    777777      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); 
    781781      $stats['output'] = $output ? unserialize($output) : ''; 
    782782      if (!$stats['output']) 
     
    784784        $stats['output'] = array(array('file' => $file, 'tests' => array(), 'stats' => array('plan' => 1, 'total' => 1, 'failed' => array(0), 'passed' => array(), 'skipped' => array()))); 
    785785      } 
    786       unlink($result_file); 
    787  
    788       $file_stats = &$stats['output'][0]['stats']; 
     786      unlink($resultFile); 
     787 
     788      $fileStats = &$stats['output'][0]['stats']; 
    789789 
    790790      $delta = 0; 
     
    796796      else 
    797797      { 
    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']; 
    806806        if (0 != $delta) 
    807807        { 
     
    811811        else 
    812812        { 
    813           $stats['status'] = $file_stats['failed'] ? 'not ok' : 'ok'; 
     813          $stats['status'] = $fileStats['failed'] ? 'not ok' : 'ok'; 
    814814          $stats['status_code'] = 0; 
    815815        } 
    816816      } 
    817817 
    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'])); 
    819819 
    820820      if (0 != $stats['status_code']) 
     
    830830      if ($delta > 0) 
    831831      { 
    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'])); 
    833833 
    834834        $this->stats['failed_tests'] += $delta; 
     
    837837      else if ($delta < 0) 
    838838      { 
    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']))); 
    847847      } 
    848848    } 
     
    859859          continue; 
    860860        } 
    861         $relative_file = $this->get_relative_file($file); 
     861        $relativeFile = $this->getRelativeFile($file); 
    862862 
    863863        if (isset($stat['output'][0])) 
    864864        { 
    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']))); 
    866866        } 
    867867        else 
    868868        { 
    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 : 0 
     869          $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 
    880880      )); 
    881881 
    882882      if ($this->options['verbose']) 
    883883      { 
    884         foreach ($this->to_array() as $testsuite) 
     884        foreach ($this->toArray() as $testSuite) 
    885885        { 
    886886          $first = true; 
    887           foreach ($testsuite['stats']['failed'] as $testcase) 
     887          foreach ($testSuite['stats']['failed'] as $testCase) 
    888888          { 
    889             if (!isset($testsuite['tests'][$testcase]['file'])) 
     889            if (!isset($testSuite['tests'][$testCase]['file'])) 
    890890            { 
    891891              continue; 
     
    895895            { 
    896896              $this->output->echoln(''); 
    897               $this->output->error($testsuite['file']); 
     897              $this->output->error($testSuite['file']); 
    898898              $first = false; 
    899899            } 
    900900 
    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); 
     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); 
    904904          } 
    905905        } 
     
    908908    else 
    909909    { 
    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'])); 
    912912    } 
    913913 
     
    915915  } 
    916916 
    917   public function get_failed_files() 
     917  public function getFailedFiles() 
    918918  { 
    919919    return isset($this->stats['failed_files']) ? $this->stats['failed_files'] : array(); 
     
    921921} 
    922922 
    923 class lime_coverage extends lime_registration 
     923class sfLimeCoverage extends sfLimeRegistration 
    924924{ 
    925925  public $files = array(); 
    926926  public $extension = '.php'; 
    927   public $base_dir = ''; 
     927  public $baseDir = ''; 
    928928  public $harness = null; 
    929929  public $verbose = false; 
     
    971971    } 
    972972 
    973     $tmp_file = sys_get_temp_dir().DIRECTORY_SEPARATOR.'test.php'; 
     973    $tmpFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.'test.php'; 
    974974    foreach ($files as $file) 
    975975    { 
     
    980980echo '<PHP_SER>'.serialize(xdebug_get_code_coverage()).'</PHP_SER>'; 
    981981EOF; 
    982       file_put_contents($tmp_file, $tmp); 
     982      file_put_contents($tmpFile, $tmp); 
    983983      ob_start(); 
    984984      // 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); 
    986986      $retval = ob_get_clean(); 
    987987 
     
    10281028    } 
    10291029 
    1030     if (file_exists($tmp_file)) 
    1031     { 
    1032       unlink($tmp_file); 
     1030    if (file_exists($tmpFile)) 
     1031    { 
     1032      unlink($tmpFile); 
    10331033    } 
    10341034  } 
     
    10371037  { 
    10381038    ksort($this->coverage); 
    1039     $total_php_lines = 0; 
    1040     $total_covered_lines = 0; 
     1039    $totalPhpLines = 0; 
     1040    $totalCoveredLines = 0; 
    10411041    foreach ($files as $file) 
    10421042    { 
    10431043      $file = realpath($file); 
    1044       $is_covered = isset($this->coverage[$file]); 
     1044      $isCovered = isset($this->coverage[$file]); 
    10451045      $cov = isset($this->coverage[$file]) ? $this->coverage[$file] : array(); 
    1046       $covered_lines = array(); 
    1047       $missing_lines = array(); 
     1046      $coveredLines = array(); 
     1047      $missingLines = array(); 
    10481048 
    10491049      foreach ($cov as $line => $flag) 
     
    10521052        { 
    10531053          case 1: 
    1054             $covered_lines[] = $line; 
     1054            $coveredLines[] = $line; 
    10551055            break; 
    10561056          case -1: 
    1057             $missing_lines[] = $line; 
     1057            $missingLines[] = $line; 
    10581058            break; 
    10591059        } 
    10601060      } 
    10611061 
    1062       $total_lines = count($covered_lines) + count($missing_lines); 
    1063       if (!$total_lines) 
     1062      $totalLines = count($coveredLines) + count($missingLines); 
     1063      if (!$totalLines) 
    10641064      { 
    10651065        // 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))); 
    10671067      } 
    10681068 
    10691069      $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) 
    10871087  { 
    10881088    if (is_readable($content)) 
     
    10921092 
    10931093    $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; 
    11011101    foreach ($tokens as $token) 
    11021102    { 
     
    11061106        { 
    11071107          case '=': 
    1108             if (false === $in_class || (false !== $in_function && !$in_function_declaration)) 
     1108            if (false === $inClass || (false !== $inFunction && !$inFunctionDeclaration)) 
    11091109            { 
    1110               $php_lines[$current_line] = true; 
     1110              $phpLines[$currentLine] = true; 
    11111111            } 
    11121112            break; 
    11131113          case '{': 
    1114             ++$open_braces; 
    1115             $in_function_declaration = false; 
     1114            ++$openBraces; 
     1115            $inFunctionDeclaration = false; 
    11161116            break; 
    11171117          case ';': 
    1118             $in_function_declaration = false; 
    1119             $end_of_current_expr = true; 
     1118            $inFunctionDeclaration = false; 
     1119            $endOfCurrentExpr = true; 
    11201120            break; 
    11211121          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) 
    11251125            { 
    1126               $in_class = false; 
     1126              $inClass = false; 
    11271127            } 
    1128             if ($open_braces == $in_function) 
     1128            if ($openBraces == $inFunction) 
    11291129            { 
    1130               $in_function = false; 
     1130              $inFunction = false; 
    11311131            } 
    11321132            break; 
     
    11421142        case T_CURLY_OPEN: 
    11431143        case T_DOLLAR_OPEN_CURLY_BRACES: 
    1144           ++$open_braces; 
     1144          ++$openBraces; 
    11451145          break; 
    11461146        case T_WHITESPACE: 
    11471147        case T_OPEN_TAG: 
    11481148        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; 
    11511151          break; 
    11521152        case T_COMMENT: 
    11531153        case T_DOC_COMMENT: 
    1154           $current_line += count(explode("\n", $text)) - 1; 
     1154          $currentLine += count(explode("\n", $text)) - 1; 
    11551155          break; 
    11561156        case T_CLASS: 
    1157           $in_class = $open_braces; 
     1157          $inClass = $openBraces; 
    11581158          break; 
    11591159        case T_FUNCTION: 
    1160           $in_function = $open_braces; 
    1161           $in_function_declaration = true; 
     1160          $inFunction = $openBraces; 
     1161          $inFunctionDeclaration = true; 
    11621162          break; 
    11631163        case T_AND_EQUAL: 
     
    12261226        case T_WHILE: 
    12271227        case T_XOR_EQUAL: 
    1228           $php_lines[$current_line] = true; 
    1229           $end_of_current_expr = false; 
     1228          $phpLines[$currentLine] = true; 
     1229          $endOfCurrentExpr = false; 
    12301230          break; 
    12311231        default: 
    1232           if (false === $end_of_current_expr) 
     1232          if (false === $endOfCurrentExpr) 
    12331233          { 
    1234             $php_lines[$current_line] = true; 
     1234            $phpLines[$currentLine] = true; 
    12351235          } 
    12361236      } 
    12371237    } 
    12381238 
    1239     return $php_lines; 
     1239    return $phpLines; 
    12401240  } 
    12411241 
    12421242  public function compute($content, $cov) 
    12431243  { 
    1244     $php_lines = self::get_php_lines($content); 
     1244    $phpLines = self::getPhpLines($content); 
    12451245 
    12461246    // 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) 
    12481248    { 
    12491249      unset($cov[$line]); 
    12501250    } 
    12511251 
    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) 
    12561256  { 
    12571257    sort($lines); 
     
    12841284} 
    12851285 
    1286 class lime_registration 
     1286class sfLimeRegistration 
    12871287{ 
    12881288  public $files = array(); 
    12891289  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); 
    13031303      } 
    13041304      else 
    13051305      { 
    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) 
    13121312  { 
    13131313    if ($dirs = glob($glob)) 
     
    13201320  } 
    13211321 
    1322   public function register_dir($directory) 
     1322  public function registerDir($directory) 
    13231323  { 
    13241324    if (!is_dir($directory)) 
     
    13291329    $files = array(); 
    13301330 
    1331     $current_dir = opendir($directory); 
    1332     while ($entry = readdir($current_dir)) 
     1331    $currentDir = opendir($directory); 
     1332    while ($entry = readdir($currentDir)) 
    13331333    { 
    13341334      if ($entry == '.' || $entry == '..') continue; 
     
    13361336      if (is_dir($entry)) 
    13371337      { 
    1338         $this->register_dir($entry); 
     1338        $this->registerDir($entry); 
    13391339      } 
    13401340      elseif (preg_match('#'.$this->extension.'$#', $entry)) 
     
    13471347  } 
    13481348 
    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)); 
    13521352  } 
    13531353} 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/can_ok.phpt

    r19496 r19882  
    11--TEST-- 
    2 can_ok method 
     2hasMethod method 
    33--FILE-- 
    44<?php 
    55require_once(dirname(__FILE__).'/setup.php'); 
    66class Test { function test() {} } 
    7 $t->can_ok(new Test(), 'test'); 
     7$t->hasMethod(new Test(), 'test'); 
    88?> 
    99--EXPECT-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/can_ok_fails.phpt

    r19498 r19882  
    11--TEST-- 
    2 can_ok method that fails 
     2hasMethod method that fails 
    33--FILE-- 
    44<?php 
    55require_once(dirname(__FILE__).'/setup.php'); 
    66class Test { function test() {} } 
    7 $t->can_ok(new Test(), 'foo'); 
     7$t->hasMethod(new Test(), 'foo'); 
    88?> 
    99--EXPECTF-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/can_ok_name.phpt

    r19496 r19882  
    11--TEST-- 
    2 can_ok method with test name 
     2hasMethod method with test name 
    33--FILE-- 
    44<?php 
    55require_once(dirname(__FILE__).'/setup.php'); 
    66class Test { function test() {} } 
    7 $t->can_ok(new Test(), 'test', 'test name'); 
     7$t->hasMethod(new Test(), 'test', 'test name'); 
    88?> 
    99--EXPECT-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/cmp_ok.phpt

    r19496 r19882  
    11--TEST-- 
    2 cmp_ok method 
     2compare method 
    33--FILE-- 
    44<?php 
    55require_once(dirname(__FILE__).'/setup.php'); 
    6 $t->cmp_ok(2, '>', 1); 
     6$t->compare(2, '>', 1); 
    77?> 
    88--EXPECT-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/cmp_ok_fails.phpt

    r19498 r19882  
    11--TEST-- 
    2 cmp_ok method that fails 
     2compare method that fails 
    33--FILE-- 
    44<?php 
    55require_once(dirname(__FILE__).'/setup.php'); 
    6 $t->cmp_ok(1, '>', 1); 
     6$t->compare(1, '>', 1); 
    77?> 
    88--EXPECTF-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/cmp_ok_name.phpt

    r19496 r19882  
    11--TEST-- 
    2 cmp_ok method with test name 
     2compare method with test name 
    33--FILE-- 
    44<?php 
    55require_once(dirname(__FILE__).'/setup.php'); 
    6 $t->cmp_ok(2, '>', 1, 'test name'); 
     6$t->compare(2, '>', 1, 'test name'); 
    77?> 
    88--EXPECT-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/include_ok.phpt

    r19496 r19882  
    11--TEST-- 
    2 include_ok method 
     2includeOk method 
    33--FILE-- 
    44<?php 
    55require_once(dirname(__FILE__).'/setup.php'); 
    6 $t->include_ok(dirname(__FILE__).'/include_test.php'); 
     6$t->includeOk(dirname(__FILE__).'/include_test.php'); 
    77?> 
    88--EXPECT-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/include_ok_fails.phpt

    r19498 r19882  
    11--TEST-- 
    2 include_ok method that fails 
     2includeOk method that fails 
    33--FILE-- 
    44<?php 
    55require_once(dirname(__FILE__).'/setup.php'); 
    6 $t->include_ok('foo.php'); 
     6$t->includeOk('foo.php'); 
    77?> 
    88--EXPECTF-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/include_ok_name.phpt

    r19496 r19882  
    11--TEST-- 
    2 include_ok method with test name 
     2includeOk method with test name 
    33--FILE-- 
    44<?php 
    55require_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'); 
    77?> 
    88--EXPECT-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/is_deeply.phpt

    r19496 r19882  
    11--TEST-- 
    2 is_deeply method 
     2isDeeply method 
    33--FILE-- 
    44<?php 
    55require_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'))); 
    77?> 
    88--EXPECT-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/is_deeply_fails.phpt

    r19498 r19882  
    11--TEST-- 
    2 is_deeply method that fails 
     2isDeeply method that fails 
    33--FILE-- 
    44<?php 
    55require_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)); 
    99?> 
    1010--EXPECTF-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/is_deeply_name.phpt

    r19496 r19882  
    11--TEST-- 
    2 is_deeply method with test name 
     2isDeeply method with test name 
    33--FILE-- 
    44<?php 
    55require_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'); 
    77?> 
    88--EXPECT-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/isa_ok.phpt

    r19496 r19882  
    11--TEST-- 
    2 isa_ok method 
     2isa method 
    33--FILE-- 
    44<?php 
    55require_once(dirname(__FILE__).'/setup.php'); 
    66class Test {} 
    7 $t->isa_ok(new Test(), 'Test'); 
     7$t->isa(new Test(), 'Test'); 
    88?> 
    99--EXPECT-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/isa_ok_fails.phpt

    r19498 r19882  
    11--TEST-- 
    2 isa_ok method that fails 
     2isa method that fails 
    33--FILE-- 
    44<?php 
    55require_once(dirname(__FILE__).'/setup.php'); 
    66class Test {} 
    7 $t->isa_ok(new Test(), 'Foo'); 
     7$t->isa(new Test(), 'Foo'); 
    88?> 
    99--EXPECTF-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/isa_ok_name.phpt

    r19496 r19882  
    11--TEST-- 
    2 isa_ok method with test name 
     2isa method with test name 
    33--FILE-- 
    44<?php 
    55require_once(dirname(__FILE__).'/setup.php'); 
    66class Test {} 
    7 $t->isa_ok(new Test(), 'Test', 'test name'); 
     7$t->isa(new Test(), 'Test', 'test name'); 
    88?> 
    99--EXPECT-- 
  • tools/lime/branches/2.0-experimental/tests/phpt/lime_test/setup.php

    r19496 r19882  
    22 
    33require_once(dirname(__FILE__).'/../../../lib/lime.php'); 
    4 $t = new lime_test(); 
     4$t = new sfLimeTest(); 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.