当前位置: 首页>>代码示例>>PHP>>正文


PHP SimpleTestCompatibility类代码示例

本文整理汇总了PHP中SimpleTestCompatibility的典型用法代码示例。如果您正苦于以下问题:PHP SimpleTestCompatibility类的具体用法?PHP SimpleTestCompatibility怎么用?PHP SimpleTestCompatibility使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SimpleTestCompatibility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _isTest

 /**
  *    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);
 }
开发者ID:nterray,项目名称:tuleap,代码行数:15,代码来源:TuleapTestCase.class.php

示例2: testInteraceComparison

 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'));
 }
开发者ID:TomMaher,项目名称:umambo,代码行数:9,代码来源:compatibility_test.php

示例3: SimpleSocket

 function SimpleSocket($host, $port, $timeout, $block_size = 255)
 {
     $this->SimpleStickyError();
     if (!($this->_handle = $this->_openSocket($host, $port, $error_number, $error, $timeout))) {
         $this->_setError("Cannot open [{$host}:{$port}] with [{$error}] within [{$timeout}] seconds");
         return;
     }
     $this->_is_open = true;
     $this->_block_size = $block_size;
     SimpleTestCompatibility::setTimeout($this->_handle, $timeout);
 }
开发者ID:BackupTheBerlios,项目名称:phpbase-svn,代码行数:11,代码来源:socket.php

示例4: testObjectReferences

 public function testObjectReferences()
 {
     $object = new ComparisonClass();
     $object_reference = $object;
     $object_copy = new ComparisonClass();
     $object_assignment = $object;
     $this->assertTrue(SimpleTestCompatibility::isReference($object, $object));
     $this->assertTrue(SimpleTestCompatibility::isReference($object, $object_reference));
     $this->assertFalse(SimpleTestCompatibility::isReference($object, $object_copy));
     $this->assertTrue(SimpleTestCompatibility::isReference($object, $object_assignment));
 }
开发者ID:VasuLief,项目名称:simpletest,代码行数:11,代码来源:compatibility_test.php

示例5: testIsA

 function testIsA() {
     $this->assertTrue(SimpleTestCompatibility::isA(
             new RandomCompatibilityClass(),
             'RandomCompatibilityClass'));
     $this->assertFalse(SimpleTestCompatibility::isA(
             new RandomCompatibilityClass(),
             'RandomCompatibilitySubclass'));
     $this->assertTrue(SimpleTestCompatibility::isA(
             new RandomCompatibilitySubclass(),
             'RandomCompatibilityClass'));
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:11,代码来源:options_test.php

示例6: isArrayOfIdenticalTypes

 /**
  *    Recursive type test for each element of an array.
  *    @param mixed $first    Test subject.
  *    @param mixed $second   Comparison object.
  *    @return boolean        True if identical.
  *    @access private
  */
 protected static function isArrayOfIdenticalTypes($first, $second)
 {
     if (array_keys($first) != array_keys($second)) {
         return false;
     }
     foreach (array_keys($first) as $key) {
         $is_identical = SimpleTestCompatibility::isIdenticalType($first[$key], $second[$key]);
         if (!$is_identical) {
             return false;
         }
     }
     return true;
 }
开发者ID:ilune,项目名称:simpletest,代码行数:20,代码来源:compatibility.php

示例7: testObjectReferences

 function testObjectReferences()
 {
     $object = new ComparisonClass();
     $object_reference =& $object;
     $object_copy = new ComparisonClass();
     $object_assignment = $object;
     $this->assertTrue(SimpleTestCompatibility::isReference($object, $object));
     $this->assertTrue(SimpleTestCompatibility::isReference($object, $object_reference));
     $this->assertFalse(SimpleTestCompatibility::isReference($object, $object_copy));
     if (version_compare(phpversion(), '5', '>=')) {
         $this->assertTrue(SimpleTestCompatibility::isReference($object, $object_assignment));
     } else {
         $this->assertFalse(SimpleTestCompatibility::isReference($object, $object_assignment));
     }
 }
开发者ID:radicaldesigns,项目名称:amp,代码行数:15,代码来源:options_test.php

示例8: testAddTwice

 function testAddTwice()
 {
     $parent = $this->generateSection(0);
     $section1 = $this->generateSection(0);
     $fakeSection1 = $this->generateSection(0);
     //will generate with the
     //same data as the section above
     $this->assertFalse(SimpleTestCompatibility::isReference($section1, $fakeSection1));
     //add once
     $parent->add($section1);
     $resultSection =& $parent->get($section1->getId());
     $this->assertNotNull($resultSection);
     $this->assertSectionsEqual($section1, $resultSection);
     //add again
     $result = $parent->add($section1);
     $this->assertTrue(PEAR::isError($result));
     $this->assertNotNull($parent->get($section1->getId()));
     //add other
     $result = $parent->add($fakeSection1);
     $this->assertTrue(PEAR::isError($result));
 }
开发者ID:akirsch,项目名称:revive-adserver,代码行数:21,代码来源:MenuSection.admin.test.php

示例9: getAssertionLine

 function getAssertionLine($format = '%d', $stack = false)
 {
     if ($stack === false) {
         $stack = SimpleTestCompatibility::getStackTrace();
     }
     return SimpleDumper::getFormattedAssertionLine($stack, $format);
 }
开发者ID:BackupTheBerlios,项目名称:phpbase-svn,代码行数:7,代码来源:simple_test.php

示例10: array

 /**
  *   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;
 }
开发者ID:ljarray,项目名称:dbpedia,代码行数:25,代码来源:simpletest.php

示例11: isIdentical

 /**
  *    Identity test. Drops back to equality for PHP5
  *    objects as the === operator counts as the
  *    stronger reference constraint.
  *    @param mixed $first    Test subject.
  *    @param mixed $second   Comparison object.
  *    @access public
  *    @static
  */
 function isIdentical($first, $second)
 {
     if (version_compare(phpversion(), '5') >= 0) {
         if (gettype($first) != gettype($second)) {
             return false;
         }
         if ($first != $second) {
             return false;
         }
         if (is_object($first) && is_object($second)) {
             return get_class($first) == get_class($second);
         }
         if (is_array($first) && is_array($second)) {
             if (array_keys($first) != array_keys($second)) {
                 return false;
             }
             foreach (array_keys($first) as $key) {
                 if (!SimpleTestCompatibility::isIdentical($first[$key], $second[$key])) {
                     return false;
                 }
             }
         }
         return true;
     }
     return $first === $second;
 }
开发者ID:BGCX067,项目名称:ezpdo2-svn-to-git,代码行数:35,代码来源:options.php

示例12: _isConstructor

 /**
  *    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));
 }
开发者ID:sebs,项目名称:simpletest,代码行数:11,代码来源:runner.php

示例13: test

 /**
  *    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;
     }
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:19,代码来源:expectation.php

示例14: testInteraceComparison

 function testInteraceComparison()
 {
     $object = new ComparisonClassWithInterface();
     $this->assertFalse(SimpleTestCompatibility::isA(new ComparisonClass(), 'ComparisonInterface'));
     $this->assertTrue(SimpleTestCompatibility::isA(new ComparisonClassWithInterface(), 'ComparisonInterface'));
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:6,代码来源:compatibility_test.php

示例15: _addCheckbox

 /**
  *    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);
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:17,代码来源:tag.php


注:本文中的SimpleTestCompatibility类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。