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


PHP SimpleExpectation::isExpectation方法代码示例

本文整理汇总了PHP中SimpleExpectation::isExpectation方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleExpectation::isExpectation方法的具体用法?PHP SimpleExpectation::isExpectation怎么用?PHP SimpleExpectation::isExpectation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleExpectation的用法示例。


在下文中一共展示了SimpleExpectation::isExpectation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: _coerceToExpectation

 function _coerceToExpectation($expected)
 {
     if (SimpleExpectation::isExpectation($expected)) {
         return $expected;
     }
     return new IdenticalExpectation($expected);
 }
开发者ID:BackupTheBerlios,项目名称:phpbase-svn,代码行数:7,代码来源:mock_objects.php

示例3: assertCookie

 /**
  *    Checks that a cookie is set for the current page
  *    and optionally checks the value.
  *    @param string $name        Name of cookie to test.
  *    @param string $expected    Expected value as a string or
  *                               false if any value will do.
  *    @param string $message     Message to display.
  *    @return boolean            True if pass.
  *    @access public
  */
 function assertCookie($name, $expected = false, $message = '%s')
 {
     $value = $this->getCookie($name);
     if (!$expected) {
         return $this->assertTrue($value, sprintf($message, "Expecting cookie [{$name}]"));
     }
     if (!SimpleExpectation::isExpectation($expected)) {
         $expected = new EqualExpectation($expected);
     }
     return $this->assert($expected, $value, "Expecting cookie [{$name}] -> {$message}");
 }
开发者ID:automatweb,项目名称:automatweb_dev,代码行数:21,代码来源:web_tester.php

示例4: expectException

 /**
  *    Sets up an expectation of an exception.
  *    This has the effect of intercepting an
  *    exception that matches.
  *    @param SimpleExpectation $expected    Expected exception to match.
  *    @param string $message                Message to display.
  *    @access public
  */
 function expectException($expected = false, $message = '%s')
 {
     if ($expected === false) {
         $expected = new AnythingExpectation();
     }
     if (!SimpleExpectation::isExpectation($expected)) {
         $expected = new ExceptionExpectation($expected);
     }
     $this->expected = $expected;
     $this->message = $message;
 }
开发者ID:clickdimension,项目名称:tinybutstrong,代码行数:19,代码来源:exceptions.php

示例5: coerceToExpectation

 /**
  *    Turns an expected exception into a SimpleExpectation object.
  *    @param mixed $exception      Exception, expectation or
  *                                 class name of exception.
  *    @return SimpleExpectation    Expectation that will match the
  *                                 exception.
  */
 private function coerceToExpectation($exception)
 {
     if ($exception === false) {
         return new AnythingExpectation();
     }
     if (!SimpleExpectation::isExpectation($exception)) {
         return new ExceptionExpectation($exception);
     }
     return $exception;
 }
开发者ID:continuousphptest,项目名称:workflow.test,代码行数:17,代码来源:exceptions.php


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