{"id":1311,"date":"2011-12-09T00:22:17","date_gmt":"2011-12-08T15:22:17","guid":{"rendered":"http:\/\/www.lancard.com\/blog\/?p=1311"},"modified":"2025-03-12T11:30:35","modified_gmt":"2025-03-12T02:30:35","slug":"bdd-with-phpunit_story","status":"publish","type":"post","link":"https:\/\/www.lancard.com\/blog\/2011\/12\/09\/bdd-with-phpunit_story\/","title":{"rendered":"PHPUnit_Story\u3067\u632f\u821e\u99c6\u52d5\u958b\u767a\u306a\u30c6\u30b9\u30c8\u3092\u66f8\u3044\u3066\u307f\u305f"},"content":{"rendered":"<p>\u30c6\u30b9\u30c8\u5bfe\u8c61\u3068\u3057\u3066Entry\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<ul>\n<li>\u30b9\u30c6\u30fc\u30bf\u30b9\uff08\u4e0b\u66f8\u304d\u30fb\u516c\u958b\u6e08\u30fb\u524a\u9664\uff09\u3092\u6301\u3064\u3002<\/li>\n<li>\u521d\u671f\u30b9\u30c6\u30fc\u30bf\u30b9\u306f\u4e0b\u66f8\u304d<\/li>\n<li>\u30b9\u30c6\u30fc\u30bf\u30b9\u306f\u30e1\u30bd\u30c3\u30c9\u3092\u901a\u3058\u3066\u5909\u66f4\u3067\u304d\u308b\u3002<\/li>\n<\/ul>\n<p><script src=\"https:\/\/gist.github.com\/1447145.js?file=Entry.php\"><\/script><\/p>\n<div>\u307e\u305a\u306f\u30c6\u30b9\u30c8\u99c6\u52d5\u958b\u767a\u306a\u30c6\u30b9\u30c8\u3092\u884c\u3046\u7c21\u5358\u306a\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002\u3053\u3093\u306a\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/div>\n<p><script src=\"https:\/\/gist.github.com\/1447145.js?file=EntryTest.php\"><\/script><\/p>\n<div>\u5b9f\u884c\u7d50\u679c\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/div>\n<pre lang=\"bash\">$ phpunit --debug EntryTest.php \r\nPHPUnit 3.6.2 by Sebastian Bergmann.\r\n\r\n\r\nStarting test 'EntryTest::testStatus'.\r\n.\r\n\r\nTime: 0 seconds, Memory: 5.50Mb\r\n\r\nOK (1 test, 3 assertions)<\/pre>\n<p>\u3053\u308c\u3092\u632f\u821e\u99c6\u52d5\u958b\u767a\u306a\u30c6\u30b9\u30c8\u3067\u66f8\u304d\u306a\u304a\u3057\u3066\u307f\u307e\u3057\u305f\u3002PHPUnit_Extensions_Story_TestCase\u3092extends\u3057\u3001runGiven\u3001runWhen\u3001runThen\u3092\u5b9f\u88c5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n<script src=\"https:\/\/gist.github.com\/1447145.js?file=EntrySpec.php\"><\/script><\/p>\n<div>\u5b9f\u884c\u7d50\u679c\u306f\u3053\u3046\u3067\u3059\u3002\u306a\u3093\u304b\u305d\u308c\u3063\u307d\u304f\u306a\u308a\u307e\u3057\u305f<\/div>\n<pre lang=\"bash\">$ phpunit --debug --verbose --printer PHPUnit_Extensions_Story_ResultPrinter_Text EntrySpec.php\r\nPHPUnit 3.6.2 by Sebastian Bergmann.\r\n\r\nEntrySpec\r\n [x] Status for new entry is draft\r\n\r\n   Given New Entry \r\n    Then Status should be draft\r\n\r\n [x] Status after publish entry is published\r\n\r\n   Given Some Entry \r\n    When publish Entry \r\n    Then Status should be published\r\n\r\n [x] Status after delete entry is deleted\r\n\r\n   Given Some Entry \r\n    When delete Entry \r\n    Then Status should be deleted\r\n\r\nScenarios: 3, Failed: 0, Skipped: 0, Incomplete: 0.<\/pre>\n<p>\u30d1\u30c3\u3068\u898b\u3001\u30b3\u30fc\u30c9\u91cf\u304c\u591a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u304c\u3001\u30c6\u30b9\u30c8\u5bfe\u8c61\u304c\u30b5\u30f3\u30d7\u30eb\u7a0b\u5ea6\u306a\u306e\u3067\u3002\u5b9f\u88c5\u304c\u5897\u3048\u3066\u304d\u305f\u3068\u304d\u306b\u3001runGiven\u3001runWhen\u3001runThen\u3092\u826f\u3044\u611f\u3058\u306b\u4f7f\u3044\u307e\u308f\u305b\u308b\u3088\u3046\u306b\u3059\u308b\u3068\u3001\u52b9\u679c\u5927\u304d\u305d\u3046\u3067\u3059\u3002<br \/>\n\u3061\u306a\u307f\u306bPHPUnit\u3001PHPUnit_Story\u3068\u3082\u306bPEAR\u3067\u30b5\u30af\u30c3\u3068\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-facebook nolightbox\" data-provider=\"facebook\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Facebook\" href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1311&#038;t=PHPUnit_Story%E3%81%A7%E6%8C%AF%E8%88%9E%E9%A7%86%E5%8B%95%E9%96%8B%E7%99%BA%E3%81%AA%E3%83%86%E3%82%B9%E3%83%88%E3%82%92%E6%9B%B8%E3%81%84%E3%81%A6%E3%81%BF%E3%81%9F&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1311&#038;p&#091;images&#093;&#091;0&#093;=&#038;p&#091;title&#093;=PHPUnit_Story%E3%81%A7%E6%8C%AF%E8%88%9E%E9%A7%86%E5%8B%95%E9%96%8B%E7%99%BA%E3%81%AA%E3%83%86%E3%82%B9%E3%83%88%E3%82%92%E6%9B%B8%E3%81%84%E3%81%A6%E3%81%BF%E3%81%9F\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"Facebook\" title=\"Share on Facebook\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/facebook.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-twitter nolightbox\" data-provider=\"twitter\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Twitter\" href=\"http:\/\/twitter.com\/share?url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1311&#038;text=PHPUnit_Story%E3%81%A7%E6%8C%AF%E8%88%9E%E9%A7%86%E5%8B%95%E9%96%8B%E7%99%BA%E3%81%AA%E3%83%86%E3%82%B9%E3%83%88%E3%82%92%E6%9B%B8%E3%81%84%E3%81%A6%E3%81%BF%E3%81%9F\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"twitter\" title=\"Share on Twitter\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/twitter.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-linkedin nolightbox\" data-provider=\"linkedin\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Linkedin\" href=\"https:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1311&#038;title=PHPUnit_Story%E3%81%A7%E6%8C%AF%E8%88%9E%E9%A7%86%E5%8B%95%E9%96%8B%E7%99%BA%E3%81%AA%E3%83%86%E3%82%B9%E3%83%88%E3%82%92%E6%9B%B8%E3%81%84%E3%81%A6%E3%81%BF%E3%81%9F\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"linkedin\" title=\"Share on Linkedin\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/linkedin.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-tumblr nolightbox\" data-provider=\"tumblr\" target=\"_blank\" rel=\"nofollow\" title=\"Share on tumblr\" href=\"https:\/\/tumblr.com\/share?s=&#038;v=3&#038;t=PHPUnit_Story%E3%81%A7%E6%8C%AF%E8%88%9E%E9%A7%86%E5%8B%95%E9%96%8B%E7%99%BA%E3%81%AA%E3%83%86%E3%82%B9%E3%83%88%E3%82%92%E6%9B%B8%E3%81%84%E3%81%A6%E3%81%BF%E3%81%9F&#038;u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1311\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"tumblr\" title=\"Share on tumblr\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/tumblr.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-mail nolightbox\" data-provider=\"mail\" rel=\"nofollow\" title=\"Share by email\" href=\"mailto:?subject=PHPUnit_Story%E3%81%A7%E6%8C%AF%E8%88%9E%E9%A7%86%E5%8B%95%E9%96%8B%E7%99%BA%E3%81%AA%E3%83%86%E3%82%B9%E3%83%88%E3%82%92%E6%9B%B8%E3%81%84%E3%81%A6%E3%81%BF%E3%81%9F&#038;body=%E3%82%B7%E3%82%A7%E3%82%A2%E3%81%99%E3%82%8B%EF%BC%9A:%20https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F1311\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"mail\" title=\"Share by email\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/mail.png\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>\u30c6\u30b9\u30c8\u5bfe\u8c61\u3068\u3057\u3066Entry\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002 \u30b9\u30c6\u30fc\u30bf\u30b9\uff08\u4e0b\u66f8\u304d\u30fb\u516c\u958b\u6e08\u30fb\u524a\u9664\uff09\u3092\u6301\u3064\u3002 \u521d\u671f\u30b9\u30c6\u30fc\u30bf\u30b9\u306f\u4e0b\u66f8\u304d \u30b9\u30c6\u30fc\u30bf\u30b9\u306f\u30e1\u30bd\u30c3\u30c9\u3092\u901a\u3058\u3066\u5909\u66f4\u3067\u304d\u308b\u3002 \u307e\u305a\u306f\u30c6\u30b9\u30c8\u99c6\u52d5\u958b\u767a\u306a\u30c6\u30b9\u30c8\u3092\u884c\u3046\u7c21\u5358\u306a\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u3092\u66f8\u3044\u3066 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[66,63,64,65],"class_list":["post-1311","post","type-post","status-publish","format-standard","hentry","category-php","tag-phpunit","tag-63","tag-64","tag-65"],"_links":{"self":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/1311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/comments?post=1311"}],"version-history":[{"count":2,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/1311\/revisions"}],"predecessor-version":[{"id":1313,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/1311\/revisions\/1313"}],"wp:attachment":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/media?parent=1311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/categories?post=1311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/tags?post=1311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}