當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IdenticalExpectation類代碼示例

本文整理匯總了PHP中IdenticalExpectation的典型用法代碼示例。如果您正苦於以下問題:PHP IdenticalExpectation類的具體用法?PHP IdenticalExpectation怎麽用?PHP IdenticalExpectation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了IdenticalExpectation類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: assertEltByIdHasAttrOfValue

 function assertEltByIdHasAttrOfValue($eltId, $attrName, $attrValueExpected = true)
 {
     $matches = array();
     $haystack = $this->getBrowser()->getContent();
     //        preg_match('/(\<[^\>]\s+id\s*=\s*"'.$eltId.'"\s+[^\>]*\>)/',$this->getBrowser()->getContent(),$matches);
     preg_match('/(\\<[^\\>]*\\s+id\\s*=\\s*"' . $eltId . '"\\s*[^\\>]*\\>)/', $haystack, $matches);
     //        echo $matches[1];
     if (!$this->assertTrue(isset($matches[1]), "Element with id [{$eltId}] should exist")) {
         return false;
     }
     $haystack = $matches[1];
     $matches = array();
     preg_match('/\\s+(' . $attrName . ')\\s*=\\s*"([^"]*)"/', $haystack, $matches);
     if (!$this->assertTrue(isset($matches[1]) && isset($matches[2]), "Element with id [{$eltId}] should have attribute of [{$attrName}]")) {
         return false;
     }
     if ($attrValueExpected === true) {
         return true;
     }
     if (!SimpleExpectation::isExpectation($attrValueExpected)) {
         $attrValueExpected = new IdenticalExpectation($attrValueExpected);
     }
     $haystack = $matches[2];
     if ($attrValueExpected->test($haystack)) {
         return true;
     }
     return $this->assert($attrValueExpected, $haystack, "Element with id [{$eltId}] attribute [{$attrName}] value does not match- " . $attrValueExpected->testMessage($haystack));
 }
開發者ID:cwarren,項目名稱:digitalfieldnotebooks,代碼行數:28,代碼來源:WMS_web_tester.php

示例2: testIdenticalComparisonOfMocksDoesNotCrash

 function testIdenticalComparisonOfMocksDoesNotCrash()
 {
     $expectation = new IdenticalExpectation(new MockDummy());
     $this->assertTrue($expectation->test(new MockDummy()));
 }
開發者ID:mahersafadi,項目名稱:joindin-api,代碼行數:5,代碼來源:mock_objects_test.php

示例3: assertClone

 /**
  *    Will trigger a pass if both parameters refer
  *    to different objects. Fail otherwise. The objects
  *    have to be identical though.
  *    @param mixed $first           Object reference to check.
  *    @param mixed $second          Hopefully not the same object.
  *    @param string $message        Message to display.
  *    @return boolean               True on pass
  *    @access public
  */
 function assertClone($first, $second, $message = '%s')
 {
     $dumper = new SimpleDumper();
     $message = sprintf($message, '[' . $dumper->describeValue($first) . '] and [' . $dumper->describeValue($second) . '] should not be the same object');
     $identical = new IdenticalExpectation($first);
     return $this->assertTrue($identical->test($second) && !($first === $second), $message);
 }
開發者ID:sebs,項目名稱:simpletest,代碼行數:17,代碼來源:unit_tester.php

示例4: _testReallyHorribleRecursiveStructure

 function _testReallyHorribleRecursiveStructure()
 {
     $hopeful = new IdenticalExpectation(new RecursiveNasty());
     $this->assertTrue($hopeful->test(new RecursiveNasty()));
 }
開發者ID:Zunair,項目名稱:xataface,代碼行數:5,代碼來源:expectation_test.php

示例5: testCanComparePrivateMembersOfObjectsWherePrivateMemberOfBaseClassIsObscured

 function testCanComparePrivateMembersOfObjectsWherePrivateMemberOfBaseClassIsObscured()
 {
     $expectFive = new IdenticalExpectation(array(new DerivedOpaqueContainer(1, 2)));
     $this->assertTrue($expectFive->test(array(new DerivedOpaqueContainer(1, 2))));
     $this->assertFalse($expectFive->test(array(new DerivedOpaqueContainer(0, 2))));
     $this->assertFalse($expectFive->test(array(new DerivedOpaqueContainer(0, 9))));
     $this->assertFalse($expectFive->test(array(new DerivedOpaqueContainer(1, 0))));
 }
開發者ID:ashukasama,項目名稱:php-liquid,代碼行數:8,代碼來源:expectation_test.php

示例6: be_clone_of

 function be_clone_of(&$first, &$second, $message = '%s')
 {
     $dumper = new SimpleDumper();
     $message = sprintf($message, '[' . $dumper->describeValue($first) . '] and [' . $dumper->describeValue($second) . '] should not be the same object');
     $identical = new IdenticalExpectation($first);
     return $this->runtime->assert(new TrueExpectation(), $identical->test($second) && !SimpleTestCompatibility::isReference($first, $second), $message);
 }
開發者ID:herlambang,項目名稱:h2o-php,代碼行數:7,代碼來源:spec.php

示例7: assertClone

 /**
  *    Will trigger a pass if both parameters refer
  *    to different objects. Fail otherwise. The objects
  *    have to be identical though.
  *    @param mixed $first           Object reference to check.
  *    @param mixed $second          Hopefully not the same object.
  *    @param string $message        Message to display.
  *    @return boolean               True on pass
  *    @access public
  */
 function assertClone(&$first, &$second, $message = "%s")
 {
     $dumper = new SimpleDumper();
     $message = sprintf($message, "[" . $dumper->describeValue($first) . "] and [" . $dumper->describeValue($second) . "] should not be the same object");
     $identical = new IdenticalExpectation($first);
     return $this->assertTrue($identical->test($second) && !SimpleTestCompatibility::isReference($first, $second), $message);
 }
開發者ID:Hassanj343,項目名稱:candidats,代碼行數:17,代碼來源:unit_tester.php

示例8: test

 /**
  *    Tests the expectation. True if it differs from the
  *    held value.
  *    @param mixed $compare        Comparison value.
  *    @return boolean              True if correct.
  *    @access public
  */
 function test($compare)
 {
     return !parent::test($compare);
 }
開發者ID:clickdimension,項目名稱:tinybutstrong,代碼行數:11,代碼來源:expectation.php

示例9: testMessage

 /**
  *    Returns a human readable test message.
  *    @param mixed $compare      Comparison value.
  *    @return string             Description of success
  *                               or failure.
  */
 function testMessage($actual)
 {
     return parent::testMessage($this->getProperty($this->name, $actual));
 }
開發者ID:hoodoogurus,項目名稱:dotprojecteap,代碼行數:10,代碼來源:expectation.php

示例10: testMessage

 public function testMessage($compare)
 {
     $compare->_message = '';
     return parent::testMessage($compare);
 }
開發者ID:kapai69,項目名稱:fl-ru-damp,代碼行數:5,代碼來源:mock_objects_test.php


注:本文中的IdenticalExpectation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。