• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SimpleExpectation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

 public function __construct($artifact_id)
 {
     parent::SimpleExpectation();
     $this->artifact_id = $artifact_id;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:5,代码来源:ChildrenXMLExporterTest.php


示例4: assert

 /**
  * Runs an expectation directly, for extending the tests with new expectation classes.
  *
  * @param SimpleExpectation $expectation Expectation subclass.
  * @param mixed             $compare     Value to compare.
  * @param string            $message     Message to display.
  *
  * @return bool True on pass
  */
 public function assert($expectation, $compare, $message = '%s')
 {
     $message = $this->escapePercentageSignsExceptFirst($message);
     if ($expectation->test($compare)) {
         return $this->pass(sprintf($message, $expectation->overlayMessage($compare, $this->reporter->getDumper())));
     } else {
         return $this->fail(sprintf($message, $expectation->overlayMessage($compare, $this->reporter->getDumper())));
     }
 }
开发者ID:simpletest,项目名称:simpletest,代码行数:18,代码来源:test_case.php


示例5: assert

 /**
  *    Runs an expectation directly, for extending the
  *    tests with new expectation classes.
  *    @param SimpleExpectation $expectation  Expectation subclass.
  *    @param mixed $compare               Value to compare.
  *    @param string $message                 Message to display.
  *    @return boolean                        True on pass
  *    @access public
  */
 function assert(&$expectation, $compare, $message = '%s') {
     if ($expectation->test($compare)) {
         return $this->pass(sprintf(
                 $message,
                 $expectation->overlayMessage($compare, $this->_reporter->getDumper())));
     } else {
         return $this->fail(sprintf(
                 $message,
                 $expectation->overlayMessage($compare, $this->_reporter->getDumper())));
     }
 }
开发者ID:nuckey,项目名称:moodle,代码行数:20,代码来源:test_case.php


示例6: 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


示例7: checkExpectation

 /**
  *    Runs an expectation directly, taking a possibly expected fail
  *    into account by turning the tables then.
  *    @param SimpleExpectation $expectation  Expectation subclass.
  *    @param mixed $compare                  Value to compare.
  *    @return boolean                        True on pass / expected fail, false on fail / unexpected pass.
  *    @access public
  */
 function checkExpectation($expectation, $compare)
 {
     $rv = $expectation->test($compare);
     return $rv;
 }
开发者ID:GerHobbelt,项目名称:simpletest,代码行数:13,代码来源:test_case.php


示例8: assertExpectation

 /**
  *    Runs an expectation directly, for extending the
  *    tests with new expectation classes.
  *    @param SimpleExpectation $expectation  Expectation subclass.
  *    @param mixed $test_value               Value to compare.
  *    @param string $message                 Message to display.
  *    @return boolean                        True on pass
  *    @access public
  */
 function assertExpectation(&$expectation, $test_value, $message = '%s')
 {
     return $this->assertTrue($expectation->test($test_value), sprintf($message, $expectation->overlayMessage($test_value)));
 }
开发者ID:radicaldesigns,项目名称:amp,代码行数:13,代码来源:simple_test.php


示例9: __construct

 public function __construct(Tracker_Workflow_Trigger_TriggerRule $trigger_rule)
 {
     parent::SimpleExpectation();
     $this->trigger_rule = $trigger_rule;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:5,代码来源:RulesManagerTest.php


示例10: 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


示例11: assertExpectation

 /**
  *    Runs an expectation directly, for extending the
  *    tests with new expectation classes.
  *    @param SimpleExpectation $expectation  Expectation subclass.
  *    @param mixed $test_value               Value to compare.
  *    @param string $message                 Message to display.
  *    @access public
  */
 function assertExpectation(&$expectation, $test_value, $message)
 {
     $this->assertTrue($expectation->test($test_value), sprintf($message, $expectation->testMessage($test_value)));
 }
开发者ID:printedheart,项目名称:iwfms,代码行数:12,代码来源:simple_test.php


示例12: __construct

 /**
  * __construct method
  *
  * @param string $key
  * @param string $value
  */
 function __construct($key, $value)
 {
     parent::SimpleExpectation('%s');
     $this->_expected = compact('key', 'value');
 }
开发者ID:hfitzgerald,项目名称:bww,代码行数:11,代码来源:migration.test.php


示例13: assert

 /**
  *    Runs an expectation directly, for extending the
  *    tests with new expectation classes.
  *    @param SimpleExpectation $expectation  Expectation subclass.
  *    @param mixed $compare               Value to compare.
  *    @param string $message                 Message to display.
  *    @return boolean                        True on pass
  *    @access public
  */
 function assert(&$expectation, $compare, $message = '%s')
 {
     return $this->assertTrue($expectation->test($compare), sprintf($message, $expectation->overlayMessage($compare)));
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:13,代码来源:test_case.php


示例14: 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


示例15: __construct

 /**
  * Sets the dom tree and the css selector to compare against
  *
  * @param mixed $dom          Dom tree to search into.
  * @param mixed $selector     Css selector to match element.
  * @param string $message     Customised message on failure.
  */
 public function __construct($dom, $selector, $message = '%s')
 {
     parent::__construct($message);
     $this->dom = $dom;
     $this->selector = $selector;
     $css_selector = new CssSelector($this->dom);
     $this->value = $css_selector->getTexts($this->selector);
 }
开发者ID:simpletest,项目名称:simpletest,代码行数:15,代码来源:dom_tester.php


示例16: __construct

 public function __construct($expected_cn)
 {
     parent::__construct();
     $this->expected = $expected_cn;
 }
开发者ID:pdaniel-frk,项目名称:tuleap,代码行数:5,代码来源:bootstrap.php


示例17: __construct

 public function __construct($repository_id)
 {
     parent::__construct();
     $this->repository_id = $repository_id;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:5,代码来源:GitRepositoryManagerTest.php


示例18:

 /**
  *    Stashes the method and expected count for later
  *    reporting.
  *    @param string $method    Name of method to confirm against.
  *    @param integer $count    Minimum number of calls.
  *    @param string $message   Custom error message.
  */
 function __construct($method, $count, $message = '%s')
 {
     $this->method = $method;
     $this->count = $count;
     parent::__construct($message);
 }
开发者ID:Boris-de,项目名称:videodb,代码行数:13,代码来源:mock_objects.php


示例19:

 function __construct($expected, $message = '%s')
 {
     parent::__construct($message);
     if (!is_object($expected)) {
         trigger_error('Attempt to create a CheckSpecifiedFieldsExpectation ' . 'with an expected value that is not an object.');
     }
     $this->expect = $expected;
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:8,代码来源:simpletestlib.php


示例20: __construct

 public function __construct($expected_field_data)
 {
     parent::__construct();
     $this->expected_field_data = $expected_field_data;
 }
开发者ID:blestab,项目名称:tuleap,代码行数:5,代码来源:XMLImportTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SimpleHtmlSaxParser类代码示例发布时间:2022-05-23
下一篇:
PHP SimpleErrorQueue类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap