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


PHP assertContains函数代码示例

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


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

示例1: test_it_gets_route_list

 public function test_it_gets_route_list()
 {
     $this->createTestPage([]);
     $this->Config->shouldReceive('get')->times(1)->andReturn(45);
     $list = $this->PagesRepository->getRouteList();
     assertContains(' Test', array_keys($list));
 }
开发者ID:alpas29,项目名称:cms,代码行数:7,代码来源:PagesRespositoryTest.php

示例2: testReturnsErrorCodeWhenSymbolsCountIsInvalid

 public function testReturnsErrorCodeWhenSymbolsCountIsInvalid()
 {
     $validator = $this->createValidator();
     $validator->setMinSymbols(1);
     $validator->isValid('foo');
     assertContains($validator::INVALID_COUNT_SYMBOLS, $validator->getErrors());
 }
开发者ID:eburhan,项目名称:password.php,代码行数:7,代码来源:ValidatorTest.php

示例3: thenEmailShouldBeSubscribedToMailinglist

 /**
  * @Given /^"([^"]*)" should be subscribed to "([^"]*)"$/
  */
 public function thenEmailShouldBeSubscribedToMailinglist($email, $mailinglistTitle)
 {
     $recipient = \Recipient::get()->filter('Email', $email)->First();
     assertNotNull($recipient, 'Could not find Recipient with ' . $email);
     $mailinglist = \MailingList::get()->filter('Title', $mailinglistTitle)->First();
     assertNotNull($mailinglist, 'Could not find MailingList with ' . $mailinglistTitle);
     assertContains($mailinglistTitle, $recipient->MailingLists()->column('Title'));
 }
开发者ID:tractorcow,项目名称:silverstripe-newsletter,代码行数:11,代码来源:FeatureContext.php

示例4: test_it_can_create_devise_docs_for_view

 public function test_it_can_create_devise_docs_for_view()
 {
     $content = 'some content';
     $this->Creator->View = m::mock('SomeViewObj');
     $this->Creator->View->shouldReceive('make')->twice()->andReturnSelf();
     $this->Creator->View->shouldReceive('render')->twice()->andReturn($content);
     $this->CommonMarkConverter->shouldReceive('convertToHtml')->once()->with($content)->andReturn($content);
     $this->LiveSpan->shouldReceive('replace')->once()->with($content)->andReturn($content);
     assertContains($content, $this->Creator->deviseDocs('devise::some.view.path'));
 }
开发者ID:alpas29,项目名称:cms,代码行数:10,代码来源:CreatorTest.php

示例5: testPublishActivities

 public function testPublishActivities()
 {
     // DATE_ISO8601 gives us 2008-07-15T15:42:47-0700
     // DATE_ATOM    gives us 2008-07-15T15:43:46-07:00
     $atString = date_create()->format(DATE_ATOM);
     $activity = new Services_Gnip_Activity($atString, 'added_friend', 'foo/bob1');
     $this->gnip->publish($this->publisher, array($activity));
     $activities = $this->gnip->getActivities($this->publisher);
     assertContains($activity, $activities);
 }
开发者ID:jeremylightsmith,项目名称:phpunit-tmbundle,代码行数:10,代码来源:example_test.php

示例6: testTheConsoleCommandReturnsWithError

 /**
  * Test to make sure that if the FormGenerator class returns false the correct feedback is provided
  */
 public function testTheConsoleCommandReturnsWithError()
 {
     // Arrange
     $formGenerator = m::mock('Grandadevans\\GenerateForm\\FormGenerator\\FormGenerator');
     $formGenerator->shouldReceive('generate')->andReturn(['path' => 'app/Forms/FooForm.php', 'status' => 'fail']);
     // Act
     $tester = new CommandTester(new FormGeneratorCommand($formGenerator, new UserFeedbackHandler()));
     $tester->execute(['name' => 'Foo']);
     // Assert
     assertContains('The form could not be saved to', $tester->getDisplay());
 }
开发者ID:GrandadEvans,项目名称:laravel-form-validator,代码行数:14,代码来源:FormGenerateCommandTest.php

示例7: assertAnyElementContainsText

 /**
  * Checks, that element with specified CSS contains specified text.
  *
  * @Then /^(?:|I )should see "(?P<text>(?:[^"]|\\")*)" in any "(?P<element>[^"]*)" element$/
  */
 public function assertAnyElementContainsText($element, $text)
 {
     $text = str_replace('\\"', '"', $text);
     $elementsText = $this->getAllElementsText($element);
     try {
         assertContains($text, $elementsText);
     } catch (AssertException $e) {
         $message = sprintf('The text "%s" was not found in the text of any element matching css "%s"', $text, $element);
         throw new \Behat\Mink\Exception\ExpectationException($message, $this->getSession(), $e);
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:16,代码来源:FeatureContext.php

示例8: testGetActivitiesWithPayload

 public function testGetActivitiesWithPayload()
 {
     $pub = $this->gnip->getPublisher($this->publisher->name, $this->scope);
     $this->assertEquals($pub, $this->publisher);
     $place = array(new Services_Gnip_Place("38.2638886 -106.126131", 5280, null, "city", "Boulder", null));
     $payload = new Services_Gnip_Payload("raw", "title", "body", array(array("mediaURL" => "http://www.flickr.com/tour", "type" => "image", "mimeType" => "image/png"), array("mediaURL" => "http://www.gnipcentral.com/login", "type" => "movie", "mimeType" => "video/quicktime")));
     $activity = new Services_Gnip_Activity("2008-07-02T11:16:16+00:00", "upload", strval(rand(0, 9999999)), "http://www.gnipcentral.com", array(array('source' => 'sms')), array(array('keyword' => 'ping'), array('keyword' => 'pong')), $place, array(array('actor' => 'bob')), array(array("destinationURL" => "http://somewhere.com", "metaURL" => "http://somewhere.com/someplace")), array(array('tag' => 'pong')), array(array('to' => 'sally', 'metaURL' => 'http://gnipcentral.com/users/sally')), null, $payload);
     $this->gnip->publish($this->publisher, array($activity), $this->scope);
     $activities = $this->gnip->getPublisherActivities($this->publisher, time(), $this->scope);
     assertContains($activity, $activities);
     $this->assertEquals($activity->payload->decodedRaw(), $activities[1]->payload->decodedRaw());
 }
开发者ID:electromute,项目名称:gnip-php,代码行数:12,代码来源:PublisherIntegrationTest.php

示例9: test_it_renames_devise_tags

 public function test_it_renames_devise_tags()
 {
     $parser = new DeviseParser();
     $traverser = new NodeTraverser();
     $traverser->addVisitor(new RegisterDeviseTags($parser));
     $nodes = $parser->parse($this->fixture('devise-views.interpret3'));
     $nodes = $traverser->traverse($nodes);
     assertContains('<body>', $nodes[9]->value);
     assertInstanceOf('PhpParser\\Node\\Stmt\\Foreach_', $nodes[10]);
     assertContains('<div data-devise-<?php echo devise_tag_cid(\'key1\', "field", null, "key1", "type", "Human name 1", null, null, null, null, null) ?>="key1">Hello there #1</div>', $nodes[10]->stmts[0]->value);
     assertContains('<div data-devise-<?php echo devise_tag_cid(\'key2\', "field", null, "key2", "type", "Human name 2", null, null, null, null, null) ?>="key2">Hello there #2</div>', $nodes[10]->stmts[1]->stmts[0]->value);
     assertContains('<p data-devise-<?php echo devise_tag_cid(\'outside\', "field", null, "outside", "type", "Outside Key", null, null, null, null, null) ?>="outside">', $nodes[11]->value);
 }
开发者ID:alpas29,项目名称:cms,代码行数:13,代码来源:RegisterDeviseTagsTest.php

示例10: assertContains

 /**
  * @Then お知らせに以下の内容が表示されていること:
  */
 public function お知らせに以下の内容が表示されていること(PyStringNode $markdown)
 {
     $page = $this->getSession()->getPage();
     $notices = $page->find('css', '.movieviewer-notices');
     assertContains($markdown->getRaw(), $notices->getText());
 }
开发者ID:montenshi,项目名称:pukiwiki-movieviewer,代码行数:9,代码来源:FeatureContext.php

示例11: assertThereIsElementContainingTexts

 /**
  * @Then /^(?:|I )should be able to find an element "(?P<element>[^"]*)" with following texts:$/
  */
 public function assertThereIsElementContainingTexts($element, TableNode $table)
 {
     $nodes = $this->getSession()->getPage()->findAll('css', $element);
     $texts = array();
     foreach ($table->getRows() as $row) {
         $texts[] = $row[0];
     }
     if (count($nodes) == 0) {
         throw new ElementNotFoundException($this->getSession(), 'element', 'css', $element);
     }
     foreach ($nodes as $node) {
         try {
             foreach ($texts as $text) {
                 assertContains($text, $node->getText());
             }
             return;
         } catch (AssertException $e) {
             // search in next node
         }
     }
     $message = sprintf('The texts "%s" was not found in any element matching css "%s"', implode('", "', $texts), $element);
     throw new ElementTextException($message, $this->getSession(), $node);
 }
开发者ID:KnpLabs,项目名称:KnpBundles,代码行数:26,代码来源:FeatureContext.php

示例12: assertElementContains

 /**
  * Checks, that element with specified CSS contains specified HTML.
  *
  * @Then /^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|\\")*)"$/
  */
 public function assertElementContains($element, $value)
 {
     $node = $this->getSession()->getPage()->find('css', $element);
     $value = str_replace('\\"', '"', $value);
     if (null === $node) {
         throw new ElementNotFoundException($this->getSession(), 'element', 'css', $element);
     }
     try {
         assertContains($value, $node->getHtml());
     } catch (AssertException $e) {
         $message = sprintf('The string "%s" was not found in the contents of the element matching css "%s"', $value, $element);
         throw new ElementHtmlException($message, $this->getSession(), $node, $e);
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:19,代码来源:BaseMinkContext.php

示例13: iShouldGetAnEmail

 /**
  * @Given /^I should get an email on "([^"]*)" with "([^"]*)"$/
  */
 public function iShouldGetAnEmail($email, $text)
 {
     $error = sprintf('No message sent to "%s"', $email);
     $profile = $this->getSymfonyProfile();
     $collector = $profile->getCollector('swiftmailer');
     foreach ($collector->getMessages() as $message) {
         // Checking the recipient email and the X-Swift-To
         // header to handle the RedirectingPlugin.
         // If the recipient is not the expected one, check
         // the next mail.
         $correctRecipient = array_key_exists($email, $message->getTo());
         $headers = $message->getHeaders();
         $correctXToHeader = false;
         if ($headers->has('X-Swift-To')) {
             $correctXToHeader = array_key_exists($email, $headers->get('X-Swift-To')->getFieldBodyModel());
         }
         if (!$correctRecipient && !$correctXToHeader) {
             continue;
         }
         $GLOBALS['email_body'] = $message->getBody();
         try {
             // checking the content
             return assertContains($text, $message->getBody());
         } catch (AssertException $e) {
             $error = sprintf('An email has been found for "%s" but without ' . 'the text "%s".', $email, $text);
         }
     }
     throw new ExpectationException($error, $this->getSession());
 }
开发者ID:elcweb,项目名称:common-bundle,代码行数:32,代码来源:SymfonyMinkContext.php

示例14: changePageSize

 /**
  * @param int $num
  */
 public function changePageSize($num)
 {
     assertContains($num, array(10, 25, 50, 100), 'Only 10, 25, 50 and 100 records per page are available');
     $element = $this->getElement('Grid toolbar')->find('css', '.page-size');
     $element->find('css', 'button')->click();
     $element->find('css', sprintf('ul.dropdown-menu li a:contains("%d")', $num))->click();
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:10,代码来源:Grid.php

示例15: ConfirmTextOnPage

 /**
  * @param $content_string
  *
  * @param $page_url
  *
  * @internal param $CiviCrm
  */
 private function ConfirmTextOnPage($content_string, $page_url)
 {
     $this->VisitPage($page_url);
     $page = $this->session->getPage();
     if (!isset($page)) {
         throw new PendingException("cannot retrieve the page!");
     }
     $page_content = $page->getContent();
     assertContains($content_string, $page_content);
 }
开发者ID:mikaylawho,项目名称:Wordpress-Development,代码行数:17,代码来源:CustomFeatureContext.php


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