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


PHP PHPUnit_Framework_Assert::assertRegExp方法代码示例

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


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

示例1: assertFakeEmailReceipt

 /**
  * @Then /^the latest email to ([^ ]+@[^ ]+) should contain "([^"]*)"$/
  */
 public function assertFakeEmailReceipt($emailAddress, $pattern)
 {
     $regex = $this->fixStepArgument($pattern);
     $inbox = $this->inboxFactory->getInbox($emailAddress);
     $email = $inbox->getLatestEmail();
     $body = $email->getBody();
     \PHPUnit_Framework_Assert::assertRegExp("/{$regex}/", $body, sprintf('Did not find an email to %s which matched "%s". Found instead: %s – ', $emailAddress, $regex, $body));
 }
开发者ID:stephenharris,项目名称:WordPressBehatExtension,代码行数:11,代码来源:WordPressMailContext.php

示例2: processAssert

 /**
  * Assert that readiness check items are passed.
  *
  * @param SetupWizard $setupWizard
  * @return void
  */
 public function processAssert(SetupWizard $setupWizard)
 {
     \PHPUnit_Framework_Assert::assertContains(self::UPDATER_APPLICATION_MESSAGE, $setupWizard->getReadiness()->getUpdaterApplicationCheck(), 'Updater application check is incorrect.');
     \PHPUnit_Framework_Assert::assertContains(self::CRON_SCRIPT_MESSAGE, $setupWizard->getReadiness()->getCronScriptCheck(), 'Cron scripts are incorrect.');
     \PHPUnit_Framework_Assert::assertContains(self::DEPENDENCY_CHECK_MESSAGE, $setupWizard->getReadiness()->getDependencyCheck(), 'Dependency check is incorrect.');
     \PHPUnit_Framework_Assert::assertContains(self::PHP_VERSION_MESSAGE, $setupWizard->getReadiness()->getPhpVersionCheck(), 'PHP version is incorrect.');
     \PHPUnit_Framework_Assert::assertContains(self::PHP_SETTING_REGEXP, $setupWizard->getReadiness()->getSettingsCheck(), 'PHP settings check failed.');
     \PHPUnit_Framework_Assert::assertRegExp(self::PHP_EXTENSIONS_REGEXP, $setupWizard->getReadiness()->getPhpExtensionsCheck(), 'PHP extensions missed.');
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:AssertSuccessfulReadinessCheck.php

示例3: seeInLogs

 public function seeInLogs(array $patterns)
 {
     foreach ($patterns as $pattern) {
         $line = stream_get_line($this->logFile, 1024, "\n");
         \PHPUnit_Framework_Assert::assertRegExp($pattern, $line);
     }
     $rest = stream_get_line($this->logFile, 1024, "\n");
     $this->assertFalse($rest);
 }
开发者ID:ttsuru,项目名称:mdl_webpay,代码行数:9,代码来源:AcceptanceHelper.php

示例4: iSeeSearchResults

    /**
     * @Then I (should) see :total search result(s)
     */
    public function iSeeSearchResults( $total )
    {
        $resultCountElement = $this->getXpath()->findXpath( "//div[@class = 'feedback']" );

        EzAssertion::assertSingleElement( 'search feedback', $resultCountElement );

        Assertion::assertRegExp(
            "/Search for \"(.*)\" returned {$total} matches/",
            $resultCountElement[0]->getText()
        );
    }
开发者ID:ataxel,项目名称:tp,代码行数:14,代码来源:Demo.php

示例5: responseDataFieldContains

 /**
  * @Then the response data :field contains :value
  */
 public function responseDataFieldContains($field, $value)
 {
     Assert::assertRegExp('/' . preg_quote($value) . '/i', $this->getResponseDataField($field));
 }
开发者ID:ingresse,项目名称:behat-api-extension,代码行数:7,代码来源:AssertContextTrait.php

示例6: assertRegExp

/**
 * Asserts that a string matches a given regular expression.
 *
 * @param  string $pattern
 * @param  string $string
 * @param  string $message
 */
function assertRegExp($pattern, $string, $message = '')
{
    return PHPUnit_Framework_Assert::assertRegExp($pattern, $string, $message);
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:11,代码来源:Functions.php

示例7: assertCommand

 protected function assertCommand($command, $arguments, $info)
 {
     $method = $info['originalMethod'];
     $result = $this->__call($method, $arguments);
     if ($info['isBoolean']) {
         if (!isset($info['negative']) || !$info['negative']) {
             PHPUnit_Framework_Assert::assertTrue($result);
         } else {
             PHPUnit_Framework_Assert::assertFalse($result);
         }
     } else {
         $expected = array_pop($arguments);
         if (strpos($expected, 'exact:') === 0) {
             $expected = substr($expected, strlen('exact:'));
             if (!isset($info['negative']) || !$info['negative']) {
                 PHPUnit_Framework_Assert::assertEquals($expected, $result);
             } else {
                 PHPUnit_Framework_Assert::assertNotEquals($expected, $result);
             }
         } else {
             if (strpos($expected, 'regexp:') === 0) {
                 $expected = substr($expected, strlen('regexp:'));
             } else {
                 if (strpos($expected, 'glob:') === 0) {
                     $expected = substr($expected, strlen('glob:'));
                 }
                 $expected = str_replace(array('*', '?'), array('.*', '.?'), $expected);
             }
             $expected = str_replace('/', '\\/', $expected);
             if (!isset($info['negative']) || !$info['negative']) {
                 PHPUnit_Framework_Assert::assertRegExp('/' . $expected . '/', $result);
             } else {
                 PHPUnit_Framework_Assert::assertNotRegExp('/' . $expected . '/', $result);
             }
         }
     }
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:37,代码来源:Driver.php

示例8: theResponseShouldContain

 /**
  * Checks that response body contains specific text.
  *
  * @param string $text
  *
  * @Then /^(?:the )?response should contain "([^"]*)"$/
  */
 public function theResponseShouldContain($text)
 {
     $expectedRegexp = '/' . preg_quote($text) . '/i';
     $actual = (string) $this->response->getBody();
     Assertions::assertRegExp($expectedRegexp, $actual);
 }
开发者ID:pavelsmolka,项目名称:WebApiExtension,代码行数:13,代码来源:WebApiContext.php

示例9: seeShellOutputMatches

 public function seeShellOutputMatches($regex)
 {
     \PHPUnit_Framework_Assert::assertRegExp($regex, $this->output);
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:4,代码来源:Cli.php

示例10: toMatchPattern

 public function toMatchPattern($pattern)
 {
     if ($this->negate) {
         a::assertNotRegExp($pattern, $this->actual);
     } else {
         a::assertRegExp($pattern, $this->actual);
     }
 }
开发者ID:jasonmccreary,项目名称:expect,代码行数:8,代码来源:Expect.php

示例11: matchesRegExp

 public function matchesRegExp($expression)
 {
     Assert::assertRegExp($expression, $this->actual, $this->description);
     return $this;
 }
开发者ID:dekeysoft,项目名称:pu-tester,代码行数:5,代码来源:StringMatcher.php

示例12: toMatch

 public function toMatch($regex)
 {
     \PHPUnit_Framework_Assert::assertRegExp($regex, $this->actual);
 }
开发者ID:danrspencer,项目名称:phpunit-expect-syntax,代码行数:4,代码来源:Expector.php

示例13: theResponseShouldContain

 /**
  * Checks that response body contains specific text.
  *
  * @param string $text
  *
  * @Then /^(?:the )?response should contain "([^"]*)"$/
  */
 public function theResponseShouldContain($text)
 {
     \PHPUnit_Framework_Assert::assertRegExp('/' . preg_quote($text) . '/', $this->browser->getLastResponse()->getContent());
 }
开发者ID:kslimani,项目名称:CommonContexts,代码行数:11,代码来源:WebApiContext.php

示例14: assertRevisionSummary

 /**
  * Asserts that the revision with the given ID has a summary matching $regex
  *
  * @param string|string[] $regex The regex to match, or an array to build a regex from
  * @param int $revid
  * @param string $message
  */
 public function assertRevisionSummary($regex, $revid, $message = '')
 {
     if (is_array($regex)) {
         $r = '';
         foreach ($regex as $s) {
             if (strlen($r) > 0) {
                 $r .= '.*';
             }
             $r .= preg_quote($s, '!');
         }
         $regex = "!{$r}!";
     }
     $entry = $this->mockRepository->getLogEntry($revid);
     Assert::assertNotNull($entry, "revision not found: {$revid}");
     Assert::assertRegExp($regex, $entry['summary'], $message);
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:23,代码来源:EntityModificationTestHelper.php

示例15: testGetAccessToken

 public function testGetAccessToken()
 {
     $response = $this->getMockBuilder('Widop\\HttpAdapter\\HttpResponse')->disableOriginalConstructor()->getMock();
     $response->expects($this->once())->method('getBody')->will($this->returnValue('oauth_token=token_key&oauth_token_secret=token_secret'));
     $this->httpAdapter->expects($this->once())->method('postContent')->with($this->equalTo('https://api.twitter.com/oauth/access_token'), $this->callback(function ($headers) {
         try {
             \PHPUnit_Framework_Assert::assertArrayHasKey('Authorization', $headers);
             \PHPUnit_Framework_Assert::assertRegExp('#OAuth oauth_verifier="oauth_verifier", oauth_version="1.0", oauth_consumer_key="consumer_key", oauth_signature_method="signature-name", oauth_token="token_key", oauth_signature="signature", oauth_nonce="(.*)", oauth_timestamp="(.*)"#', $headers['Authorization']);
             return true;
         } catch (\Exception $e) {
             return false;
         }
     }))->will($this->returnValue($response));
     $accessToken = $this->oauth->getAccessToken(new OAuthToken('token_key', 'token_secret'), 'oauth_verifier');
     $this->assertInstanceOf('Widop\\Twitter\\OAuth\\Token\\OAuthToken', $accessToken);
     $this->assertSame('token_key', $accessToken->getKey());
     $this->assertSame('token_secret', $accessToken->getSecret());
 }
开发者ID:widop,项目名称:twitter-oauth,代码行数:18,代码来源:OAuthTest.php


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