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


PHP SimpleExpectation类代码示例

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


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

示例12: __construct

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

示例13: __construct

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

示例14:

 /**
  *    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

示例15:

 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


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