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


PHP Locator::humanReadableString方法代码示例

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


在下文中一共展示了Locator::humanReadableString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testHumanReadableString

 public function testHumanReadableString()
 {
     $this->assertEquals("'string selector'", Locator::humanReadableString("string selector"));
     $this->assertEquals("css '.something'", Locator::humanReadableString(['css' => '.something']));
     $this->assertEquals("css selector '.something'", Locator::humanReadableString(WebDriverBy::cssSelector('.something')));
     try {
         Locator::humanReadableString(null);
         $this->fail("Expected exception when calling humanReadableString() with invalid selector");
     } catch (\InvalidArgumentException $e) {
     }
 }
开发者ID:janhenkgerritsen,项目名称:Codeception,代码行数:11,代码来源:LocatorTest.php

示例2: fail

 protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null)
 {
     $selectorString = Locator::humanReadableString($selector);
     if (!$this->string) {
         throw new \PHPUnit_Framework_ExpectationFailedException("Element {$selectorString} was found", $comparisonFailure);
     }
     $output = "There was {$selectorString} element";
     $output .= $this->uriMessage("on page");
     $output .= str_replace($this->string, "<bold>{$this->string}</bold>", $this->nodesList($nodes, $this->string));
     $output .= "\ncontaining '{$this->string}'";
     throw new \PHPUnit_Framework_ExpectationFailedException($output, $comparisonFailure);
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:12,代码来源:WebDriverNot.php

示例3: testGetArguments

 public function testGetArguments()
 {
     $by = WebDriverBy::cssSelector('.something');
     $step = $this->getStep([null, [$by]]);
     $this->assertEquals('"' . Locator::humanReadableString($by) . '"', $step->getArguments(true));
     $step = $this->getStep([null, [['just', 'array']]]);
     $this->assertEquals('"just","array"', $step->getArguments(true));
     $step = $this->getStep([null, [function () {
     }]]);
     $this->assertEquals('"lambda function"', $step->getArguments(true));
     $step = $this->getStep([null, [[$this, 'testGetArguments']]]);
     $this->assertEquals('"callable function"', $step->getArguments(true));
 }
开发者ID:Marfuz,项目名称:c4t_test,代码行数:13,代码来源:StepTest.php

示例4: testGetArguments

 public function testGetArguments()
 {
     $by = WebDriverBy::cssSelector('.something');
     $step = $this->getStep([null, [$by]]);
     $this->assertEquals('"' . Locator::humanReadableString($by) . '"', $step->getArgumentsAsString());
     $step = $this->getStep([null, [['just', 'array']]]);
     $this->assertEquals('["just","array"]', $step->getArgumentsAsString());
     $step = $this->getStep([null, [function () {
     }]]);
     $this->assertEquals('"Closure"', $step->getArgumentsAsString());
     $step = $this->getStep([null, [[$this, 'testGetArguments']]]);
     $this->assertEquals('["StepTest","testGetArguments"]', $step->getArgumentsAsString());
     $step = $this->getStep([null, [['PDO', 'getAvailableDrivers']]]);
     $this->assertEquals('["PDO","getAvailableDrivers"]', $step->getArgumentsAsString());
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:15,代码来源:StepTest.php

示例5: fail

 protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null)
 {
     if (!count($nodes)) {
         throw new ElementNotFound($selector, 'Element located either by name, CSS or XPath');
     }
     $output = "Failed asserting that any element by " . Locator::humanReadableString($selector);
     $output .= $this->uriMessage('on page');
     if (count($nodes) < 5) {
         $output .= "\nElements: ";
         $output .= $this->nodesList($nodes);
     } else {
         $message = new Message("[total %s elements]");
         $output .= $message->with(count($nodes))->style('debug');
     }
     $output .= "\ncontains text '" . $this->string . "'";
     throw new \PHPUnit_Framework_ExpectationFailedException($output, $comparisonFailure);
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:17,代码来源:WebDriver.php

示例6: parseArgumentAsString

 protected function parseArgumentAsString($argument)
 {
     if (is_object($argument)) {
         if (method_exists($argument, '__toString')) {
             return (string) $argument;
         }
         if (get_class($argument) == 'Facebook\\WebDriver\\WebDriverBy') {
             return Locator::humanReadableString($argument);
         }
         return $this->getClassName($argument);
     }
     if (is_array($argument)) {
         foreach ($argument as $key => $value) {
             if (is_object($value)) {
                 $argument[$key] = $this->getClassName($value);
             }
         }
         return $argument;
     }
     if (is_resource($argument)) {
         return (string) $argument;
     }
     return $argument;
 }
开发者ID:yurireeis,项目名称:CodeCeptionTest,代码行数:24,代码来源:Step.php

示例7: testGetArguments

 public function testGetArguments()
 {
     $by = WebDriverBy::cssSelector('.something');
     $step = $this->getMockBuilder('\\Codeception\\Step')->setConstructorArgs([null, [$by]])->setMethods(null)->getMock();
     $this->assertEquals('"' . Locator::humanReadableString($by) . '"', $step->getArguments(true));
 }
开发者ID:vladislavl-hyuna,项目名称:crmapp,代码行数:6,代码来源:StepTest.php

示例8: parseArgumentAsString

 protected function parseArgumentAsString($argument)
 {
     if (is_object($argument)) {
         if (method_exists($argument, '__toString')) {
             return (string) $argument;
         }
         if (get_class($argument) == 'Facebook\\WebDriver\\WebDriverBy') {
             return Locator::humanReadableString($argument);
         }
     }
     if ($argument instanceof \Closure) {
         return 'lambda function';
     }
     if (is_callable($argument)) {
         return 'callable function';
     }
     if (!is_object($argument)) {
         return $argument;
     }
     return isset($argument->__mocked) ? $this->formatClassName($argument->__mocked) : $this->formatClassName(get_class($argument));
 }
开发者ID:neronmoon,项目名称:Codeception,代码行数:21,代码来源:Step.php

示例9: stringifyArgument

 protected function stringifyArgument($argument)
 {
     if (is_string($argument)) {
         return '"' . strtr($argument, ["\n" => '\\n', "\r" => '\\r', "\t" => ' ']) . '"';
     } elseif (is_resource($argument)) {
         $argument = (string) $argument;
     } elseif (is_array($argument)) {
         foreach ($argument as $key => $value) {
             if (is_object($value)) {
                 $argument[$key] = $this->getClassName($value);
             }
         }
     } elseif (is_object($argument)) {
         if (method_exists($argument, '__toString')) {
             $argument = (string) $argument;
         } elseif (get_class($argument) == 'Facebook\\WebDriver\\WebDriverBy') {
             $argument = Locator::humanReadableString($argument);
         } else {
             $argument = $this->getClassName($argument);
         }
     }
     return json_encode($argument, JSON_UNESCAPED_UNICODE);
 }
开发者ID:janhenkgerritsen,项目名称:Codeception,代码行数:23,代码来源:Step.php

示例10: __construct

 public function __construct($selector, $message = null)
 {
     $selector = Locator::humanReadableString($selector);
     parent::__construct($message . " element with {$selector} was not found.");
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:5,代码来源:ElementNotFound.php


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