當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。