コード例 #1
0
ファイル: spec.php プロジェクト: herlambang/h2o-php
 function _isTest($method)
 {
     if (strtolower(substr($method, 0, 2)) == 'it' || strtolower(substr($method, 0, 6)) == 'should') {
         return !SimpleTestCompatibility::isA($this, strtolower($method));
     }
     return false;
 }
コード例 #2
0
 /**
  *    Tests to see if the method is a test that should
  *    be run, override default by searching methods that starts with 'it'
  *    is a candidate unless it is the constructor.
  *    @param string $method        Method name to try.
  *    @return boolean              True if test method.
  *    @access protected
  */
 function _isTest($method)
 {
     if (strtolower(substr($method, 0, 2)) == 'it') {
         return !SimpleTestCompatibility::isA($this, strtolower($method));
     }
     return parent::_isTest($method);
 }
コード例 #3
0
 function testInteraceComparison()
 {
     if (version_compare(phpversion(), '5', '<')) {
         return;
     }
     $object = new ComparisonClassWithInterface();
     $this->assertFalse(SimpleTestCompatibility::isA(new ComparisonClass(), 'ComparisonInterface'));
     $this->assertTrue(SimpleTestCompatibility::isA(new ComparisonClassWithInterface(), 'ComparisonInterface'));
 }
コード例 #4
0
 function testIsA() {
     $this->assertTrue(SimpleTestCompatibility::isA(
             new RandomCompatibilityClass(),
             'RandomCompatibilityClass'));
     $this->assertFalse(SimpleTestCompatibility::isA(
             new RandomCompatibilityClass(),
             'RandomCompatibilitySubclass'));
     $this->assertTrue(SimpleTestCompatibility::isA(
             new RandomCompatibilitySubclass(),
             'RandomCompatibilityClass'));
 }
コード例 #5
0
ファイル: tag.php プロジェクト: BackupTheBerlios/limb-svn
 /**
  *    Adds a checkbox, making it a group on a repeated name.
  *    @param SimpleCheckboxTag $tag   Incoming form control.
  *    @access private
  */
 function _addCheckbox($tag) {
     if (! isset($this->_widgets[$tag->getName()])) {
         $this->_widgets[$tag->getName()] = &$tag;
     } elseif (! SimpleTestCompatibility::isA($this->_widgets[$tag->getName()], 'SimpleCheckboxGroup')) {
         $previous = &$this->_widgets[$tag->getName()];
         $this->_widgets[$tag->getName()] = &new SimpleCheckboxGroup();
         $this->_widgets[$tag->getName()]->addWidget($previous);
         $this->_widgets[$tag->getName()]->addWidget($tag);
     } else {
         $this->_widgets[$tag->getName()]->addWidget($tag);
     }
 }
コード例 #6
0
ファイル: unit_tester.php プロジェクト: rolwi/koala
 /**
  *    Creates an equality expectation if the
  *    object/value is not already some type
  *    of expectation.
  *    @param mixed $expected      Expected value.
  *    @return SimpleExpectation   Expectation object.
  *    @access private
  */
 function _coerceExpectation($expected)
 {
     if ($expected == false) {
         return new TrueExpectation();
     }
     if (SimpleTestCompatibility::isA($expected, 'SimpleExpectation')) {
         return $expected;
     }
     return new EqualExpectation(is_string($expected) ? str_replace('%', '%%', $expected) : $expected);
 }
コード例 #7
0
ファイル: test_case.php プロジェクト: nuckey/moodle
 /**
  *    Tests to see if the method is a test that should
  *    be run. Currently any method that starts with 'test'
  *    is a candidate unless it is the constructor.
  *    @param string $method        Method name to try.
  *    @return boolean              True if test method.
  *    @access protected
  */
 function _isTest($method) {
     if (strtolower(substr($method, 0, 4)) == 'test') {
         return ! SimpleTestCompatibility::isA($this, strtolower($method));
     }
     return false;
 }
コード例 #8
0
ファイル: simpletest.php プロジェクト: ljarray/dbpedia
 /**
  *   Retrieves 'preferred' objects from global pool. Class filter
  *   can be applied in order to retrieve the object of the specific
  *   class
  *   @param array|string $classes       Allowed classes or interfaces.
  *   @static
  *   @access public
  *   @return array|object|null
  *   @see prefer()
  */
 function &preferred($classes)
 {
     if (!is_array($classes)) {
         $classes = array($classes);
     }
     $registry =& SimpleTest::_getRegistry();
     for ($i = count($registry['Preferred']) - 1; $i >= 0; $i--) {
         foreach ($classes as $class) {
             if (SimpleTestCompatibility::isA($registry['Preferred'][$i], $class)) {
                 return $registry['Preferred'][$i];
             }
         }
     }
     return null;
 }
コード例 #9
0
ファイル: runner.php プロジェクト: sebs/simpletest
 /**
  *    Tests to see if the method is the constructor and
  *    so should be ignored.
  *    @param string $method        Method name to try.
  *    @return boolean              True if constructor.
  *    @access protected
  */
 function _isConstructor($method)
 {
     return SimpleTestCompatibility::isA($this->_test_case, strtolower($method));
 }
コード例 #10
0
 /**
  *    Tests the expectation. True if the type or
  *    class matches the string value.
  *    @param string $compare        Comparison value.
  *    @return boolean               True if correct.
  *    @access public
  */
 function test($compare)
 {
     if (is_object($compare)) {
         return SimpleTestCompatibility::isA($compare, $this->type);
     } else {
         $function = 'is_' . $this->canonicalType($this->type);
         if (is_callable($function)) {
             return $function($compare);
         }
         return false;
     }
 }
コード例 #11
0
 /**
  * IsTest method
  *
  * Prevent intensive W3 test, and the build tests (used to generate the testSection tests) unless
  * explicitly specified
  *
  * @param mixed $method
  * @return void
  */
 protected function _isTest($method)
 {
     if (strtolower($method) === 'testaction') {
         return false;
     }
     $buildTests = ['testw3validity', 'testbuildregex', 'testbuildtest'];
     if (in_array(strtolower($method), $buildTests)) {
         return !$this->skipSetupTests;
     }
     if (strtolower(substr($method, 0, 4)) === 'test') {
         if (!$this->skipSetupTests) {
             return false;
         }
         return !SimpleTestCompatibility::isA($this, strtolower($method));
     }
     return false;
 }
コード例 #12
0
ファイル: options_test.php プロジェクト: radicaldesigns/amp
 function testIsA()
 {
     $this->assertTrue(SimpleTestCompatibility::isA(new ComparisonClass(), 'ComparisonClass'));
     $this->assertFalse(SimpleTestCompatibility::isA(new ComparisonClass(), 'ComparisonSubclass'));
     $this->assertTrue(SimpleTestCompatibility::isA(new ComparisonSubclass(), 'ComparisonClass'));
 }
コード例 #13
0
 function testInteraceComparison()
 {
     $object = new ComparisonClassWithInterface();
     $this->assertFalse(SimpleTestCompatibility::isA(new ComparisonClass(), 'ComparisonInterface'));
     $this->assertTrue(SimpleTestCompatibility::isA(new ComparisonClassWithInterface(), 'ComparisonInterface'));
 }
コード例 #14
0
 /**
  *    Tests the expectation. True if the type or
  *    class matches the string value.
  *    @param string $compare        Comparison value.
  *    @return boolean               True if correct.
  *    @access public
  */
 function test($compare)
 {
     if (is_object($compare)) {
         return SimpleTestCompatibility::isA($compare, $this->_type);
     } else {
         return strtolower(gettype($compare)) == $this->_canonicalType($this->_type);
     }
 }
コード例 #15
0
ファイル: unit_tester.php プロジェクト: TomMaher/umambo
 /**
  *    Creates an equality expectation if the
  *    object/value is not already some type
  *    of expectation.
  *    @param mixed $expected      Expected value.
  *    @return SimpleExpectation   Expectation object.
  *    @access private
  */
 function _coerceToExpectation($expected)
 {
     if (SimpleTestCompatibility::isA($expected, 'SimpleExpectation')) {
         return $expected;
     }
     return new EqualExpectation($expected);
 }
コード例 #16
0
ファイル: form.php プロジェクト: Boris-de/videodb
 /**
  *    Adds a checkbox, making it a group on a repeated name.
  *    @param SimpleCheckboxTag $tag   Incoming form control.
  *    @access private
  */
 protected function addCheckbox($tag)
 {
     if (!isset($this->checkboxes[$tag->getName()])) {
         $this->widgets[] = $tag;
         $this->checkboxes[$tag->getName()] = count($this->widgets) - 1;
     } else {
         $index = $this->checkboxes[$tag->getName()];
         if (!SimpleTestCompatibility::isA($this->widgets[$index], 'SimpleCheckboxGroup')) {
             $previous = $this->widgets[$index];
             $this->widgets[$index] = new SimpleCheckboxGroup();
             $this->widgets[$index]->addWidget($previous);
         }
         $this->widgets[$index]->addWidget($tag);
     }
 }
コード例 #17
0
ファイル: test_case.php プロジェクト: knevcher/limb
 /**
  *    Tests to see if the method is a test that should
  *    be run. Currently any method that starts with 'test'
  *    is a candidate unless it is the constructor.
  *    @param string $method        Method name to try.
  *    @return boolean              True if test method.
  *    @access protected
  */
 function _isTest($method)
 {
     if (strtolower(substr($method, 0, 4)) == 'test') {
         if (count($this->_methods_filter) && !in_array(strtolower($method), $this->_methods_filter)) {
             return false;
         }
         return !SimpleTestCompatibility::isA($this, strtolower($method));
     }
     return false;
 }