{"id":1433,"date":"2014-04-01T17:17:10","date_gmt":"2014-04-01T08:17:10","guid":{"rendered":"http:\/\/www.mogumagu.com\/wp\/wordpress\/?p=1433"},"modified":"2014-04-01T17:26:34","modified_gmt":"2014-04-01T08:26:34","slug":"php%ef%bc%9abdd%e3%82%92%e8%a9%a6%e3%81%99%e3%80%82behatmink%e7%b7%a8","status":"publish","type":"post","link":"https:\/\/www.mogumagu.com\/wp\/wordpress\/archives\/1433","title":{"rendered":"PHP\uff1aBDD\u3092\u8a66\u3059\u3002Behat+Mink\u7de8"},"content":{"rendered":"<div class=\"65a9d09a7d046572b7ae2e4674a406ee\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-0496250084394782\";\r\ngoogle_ad_slot = \"5624605187\";\r\ngoogle_ad_width = 300;\r\ngoogle_ad_height = 250;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"https:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n<h2>PHP\uff1aBDD\u3092\u8a66\u3059\u3002Behat+Mink\u7de8<\/h2>\n<p>BDD\u306b\u8208\u5473\u3092\u3082\u3063\u305f\u306e\u3067\u307e\u305a\u306fbehat\u3092\u8a66\u3057\u3066\u307f\u308b\u3002<\/p>\n<p><a title=\"Video: Quickstart to testing with Behat, Mink, and Selenium\" href=\"http:\/\/lin-clark.com\/blog\/2013\/11\/26\/quickstart-testing-with-behat-mink-selenium\/\" target=\"_blank\">Video: Quickstart to testing with Behat, Mink, and Selenium<\/a><\/p>\n<p>\u4e0a\u8a18\u306e\u52d5\u753b\u3092\u53c2\u8003\u306b\u5199\u7d4c\u3002<\/p>\n<p>\u4eca\u56de\u306e\u69cb\u6210<br \/>\n<strong>\u25a0\u958b\u767a\u30b5\u30fc\u30d0<\/strong><br \/>\nOS:CentOS6.5(Vagrant\u74b0\u5883:windows7\u5185\u306b\u3042\u308b)<br \/>\nIP:192.168.1.226<\/p>\n<h3>\u25a0composer\u306e\u8a2d\u5b9a<\/h3>\n<p>\u9069\u5f53\u306a\u30d5\u30a9\u30eb\u30c0\u306b\u79fb\u52d5\u3057\u3066composer.json\u3092\u4f5c\u6210\u3059\u308b\u3002<br \/>\n\u203bcomposer\u81ea\u4f53\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u308b\u3068\u3059\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ vim composer.json\r\n{\r\n  &quot;require&quot;: {\r\n    &quot;behat\/behat&quot;: &quot;2.4.*@stable&quot;,\r\n    &quot;behat\/mink&quot;: &quot;1.5.*@stable&quot;,\r\n    &quot;behat\/mink-goutte-driver&quot;: &quot;*&quot;,\r\n    &quot;behat\/mink-extension&quot;: &quot;*&quot;,\r\n    &quot;behat\/mink-selenium2-driver&quot;: &quot;*&quot;\r\n  }\r\n}\r\n<\/pre>\n<h3>\u25a0behat,mink\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ php composer.phar install\r\n<\/pre>\n<h3>\u25a0behat\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308bbehat.yml\u3092\u4f5c\u6210<\/h3>\n<p>composer.json\u3068\u540c\u3058\u5834\u6240\u306bbehat.yml\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ vim behat.yml\r\ndefault:\r\n  paths:\r\n    features: features\r\n    bootstrap: %behat.paths.features%\/bootstrap\r\n  extensions:\r\n    Behat\\MinkExtension\\Extension:\r\n      goutte: ~\r\n<\/pre>\n<h3>\u25a0behat\u3092\u521d\u671f\u5316\uff08features\u30d5\u30a9\u30eb\u30c0\u304c\u4f5c\u6210\u3055\u308c\u308b\uff09<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ .\/vender\/bin\/behat --init\r\n<\/pre>\n<h3>\u25a0test.feature\u30b7\u30ca\u30ea\u30aa\u3092\u4f5c\u6210<\/h3>\n<p>\u203b\u30d5\u30a1\u30a4\u30eb\u540d\u306f\u9069\u5f53\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ vim features\/test.feature\r\nFeature: Drupal.org search\r\n  In order to find modules on Drupal.org\r\n  As a Drupal user\r\n  I need to be able to use Drupal.org search\r\n\r\n  Scenario: Searching for &quot;behat&quot;\r\n    Given I go to &quot;https:\/\/drupal.org&quot;\r\n    When I fill in &quot;Search Drupal.org&quot; with &quot;behat&quot;\r\n    And I press &quot;Search&quot;\r\n    Then I should see &quot;Behat Drupal Extension&quot;\r\n<\/pre>\n<h3>\u25a0mink\u3092\u5229\u7528\u3059\u308b\u305f\u3081\u306b\u300cFeatureContext.php\u300d\u3092\u4fee\u6b63<\/h3>\n<p>use\u3084extends\u3092\u5909\u66f4<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ vim features\/bootstrap\/FeatureContext.php\r\n&lt;?php\r\n\r\nuse Behat\\Behat\\Context\\ClosuredContextInterface,\r\n    Behat\\Behat\\Context\\TranslatedContextInterface,\r\n    Behat\\Behat\\Context\\BehatContext,\r\n    Behat\\Behat\\Exception\\PendingException;\r\nuse Behat\\Gherkin\\Node\\PyStringNode,\r\n    Behat\\Gherkin\\Node\\TableNode;\r\nuse Behat\\MinkExtension\\Context\\MinkContext;\r\n\/\/\r\n\/\/ Require 3rd-party libraries here:\r\n\/\/\r\n\/\/   require_once 'PHPUnit\/Autoload.php';\r\n\/\/   require_once 'PHPUnit\/Framework\/Assert\/Functions.php';\r\n\/\/\r\n\r\n\/**\r\n * Features context.\r\n *\/\r\nclass FeatureContext extends MinkContext\r\n{\r\n    \/**\r\n     * Initializes context.\r\n     * Every scenario gets it's own context object.\r\n     *\r\n     * @param array $parameters context parameters (set them up through behat.yml)\r\n     *\/\r\n    public function __construct(array $parameters)\r\n    {\r\n        \/\/ Initialize your context here\r\n    }\r\n\r\n\/\/\r\n\/\/ Place your definition and hook methods here:\r\n\/\/\r\n\/\/    \/**\r\n\/\/     * @Given \/^I have done something with &quot;([^&quot;]*)&quot;$\/\r\n\/\/     *\/\r\n\/\/    public function iHaveDoneSomethingWith($argument)\r\n\/\/    {\r\n\/\/        doSomethingWith($argument);\r\n\/\/    }\r\n\/\/\r\n}\r\n<\/pre>\n<h3>\u25a0behat\u3092\u5b9f\u884c<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ .\/vendor\/bin\/behat\r\nFeature: Drupal.org search\r\n  In order to find modules on Drupal.org\r\n  As a Drupal user\r\n  I need to be able to use Drupal.org search\r\n\r\n  Scenario: Searching for &quot;behat&quot;                   # features\/test.feature:6\r\n    Given I go to &quot;https:\/\/drupal.org&quot;              # FeatureContext::visit()\r\n    When I fill in &quot;Search Drupal.org&quot; with &quot;behat&quot; # FeatureContext::fillField()\r\n    And I press &quot;Search&quot;                            # FeatureContext::pressButton()\r\n    Then I should see &quot;Behat Drupal Extension&quot;      # FeatureContext::assertPageContainsText()\r\n\r\n1 scenario (1 passed)\r\n4 steps (4 passed)\r\n0m2.492s\r\n<\/pre>\n<p>\u3068\u308a\u3042\u3048\u305a\u52d5\u3044\u305f\u3002<br \/>\n<a title=\"PHP\uff1aBDD\u3092\u8a66\u3059\u3002Behat+Mink+Selenium\u7de8\" href=\"http:\/\/www.mogumagu.com\/wp\/wordpress\/?p=1439\" target=\"_blank\">\u6b21\u56de\u306fSelenium\u3092\u8ffd\u52a0\u3057\u3066\u30d6\u30e9\u30a6\u30b6\u3067\u306e\u6319\u52d5\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/a><\/p>\n<div class=\"65a9d09a7d046572b7ae2e4674a406ee\" data-index=\"3\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\namazon_ad_tag = \"lax34weddojp-22\"; amazon_ad_width = \"468\"; amazon_ad_height = \"60\"; amazon_ad_link_target = \"new\"; amazon_ad_border = \"hide\";\/\/--><\/script>\r\n<script type=\"text\/javascript\" src=\"https:\/\/www.assoc-amazon.jp\/s\/ads.js\"><\/script>\n<\/div>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>PHP\uff1aBDD\u3092\u8a66\u3059\u3002Behat+Mink\u7de8 BDD\u306b\u8208\u5473\u3092\u3082\u3063\u305f\u306e\u3067\u307e\u305a\u306fbehat\u3092\u8a66\u3057\u3066\u307f\u308b\u3002 Video: Quickstart to testing with Behat, Mink, and Selenium [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[28],"tags":[],"_links":{"self":[{"href":"https:\/\/www.mogumagu.com\/wp\/wordpress\/wp-json\/wp\/v2\/posts\/1433"}],"collection":[{"href":"https:\/\/www.mogumagu.com\/wp\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mogumagu.com\/wp\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mogumagu.com\/wp\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mogumagu.com\/wp\/wordpress\/wp-json\/wp\/v2\/comments?post=1433"}],"version-history":[{"count":6,"href":"https:\/\/www.mogumagu.com\/wp\/wordpress\/wp-json\/wp\/v2\/posts\/1433\/revisions"}],"predecessor-version":[{"id":1442,"href":"https:\/\/www.mogumagu.com\/wp\/wordpress\/wp-json\/wp\/v2\/posts\/1433\/revisions\/1442"}],"wp:attachment":[{"href":"https:\/\/www.mogumagu.com\/wp\/wordpress\/wp-json\/wp\/v2\/media?parent=1433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mogumagu.com\/wp\/wordpress\/wp-json\/wp\/v2\/categories?post=1433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mogumagu.com\/wp\/wordpress\/wp-json\/wp\/v2\/tags?post=1433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}