{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"TDD","type":"basic","slug":"tdd","excerpt":"","body":"#Test Driven Development\n\nWe start by creating the failing tests that defines the behavior of our new feature\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\nclass CreatePostTest extends TestCase\\n{\\n\\n  public function testStoresPostSuccessfully()\\n  {\\n   \\n    $post = factory(App\\\\Post::class)->make();\\n    \\n    $this->post('/api/posts', [\\n      'name' => $post->name,\\n      'topic' => $post->topic,\\n      ])->seeApiSuccess()\\n      ->seeJsonObject('post')\\n      ->seeJson([\\n        'name' => $post->name,\\n        'topic' => $post->topic,\\n      ]);\\n    \\n    $this->seeInDatabase('posts', [\\n      'name' => $post->name,\\n      'topic' => $post->topic,\\n      ]);\\n  }\\n  \\n}\",\n      \"language\": \"php\",\n      \"name\": \"CreatePostTest.php\"\n    }\n  ]\n}\n[/block]\n> Prefer a screencast?\n[block:html]\n{\n  \"html\": \"<iframe width=\\\"560\\\" height=\\\"315\\\" src=\\\"https://www.youtube.com/embed/_ZWV9KBK2N8\\\" frameborder=\\\"0\\\" allowfullscreen></iframe>\"\n}\n[/block]","updates":["57f6532fcecf1517001f02d0"],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"57ffd85f755a2e1700c2bb16","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Tutorial","slug":"tutorial","order":1,"from_sync":false,"reference":false,"_id":"57ffd85f755a2e1700c2bb07","createdAt":"2015-12-18T23:07:56.909Z","project":"567083021dabd80d00b122ae","__v":0,"version":"57ffd85f755a2e1700c2bb05"},"parentDoc":null,"user":"567082433a32d20d00c45cab","createdAt":"2015-12-22T22:52:56.182Z","githubsync":"","project":"567083021dabd80d00b122ae","version":{"version":"3.4","version_clean":"3.4.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["57ffd85f755a2e1700c2bb06","57ffd85f755a2e1700c2bb07","57ffd85f755a2e1700c2bb08","57ffd85f755a2e1700c2bb09","57ffd85f755a2e1700c2bb0a","57ffd85f755a2e1700c2bb0b","57ffd85f755a2e1700c2bb0c","57ffd85f755a2e1700c2bb0d"],"_id":"57ffd85f755a2e1700c2bb05","project":"567083021dabd80d00b122ae","releaseDate":"2016-10-13T18:54:23.018Z","__v":1,"createdAt":"2016-10-13T18:54:23.018Z"},"__v":0}
#Test Driven Development We start by creating the failing tests that defines the behavior of our new feature [block:code] { "codes": [ { "code": "<?php\n\nclass CreatePostTest extends TestCase\n{\n\n public function testStoresPostSuccessfully()\n {\n \n $post = factory(App\\Post::class)->make();\n \n $this->post('/api/posts', [\n 'name' => $post->name,\n 'topic' => $post->topic,\n ])->seeApiSuccess()\n ->seeJsonObject('post')\n ->seeJson([\n 'name' => $post->name,\n 'topic' => $post->topic,\n ]);\n \n $this->seeInDatabase('posts', [\n 'name' => $post->name,\n 'topic' => $post->topic,\n ]);\n }\n \n}", "language": "php", "name": "CreatePostTest.php" } ] } [/block] > Prefer a screencast? [block:html] { "html": "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/_ZWV9KBK2N8\" frameborder=\"0\" allowfullscreen></iframe>" } [/block]