Permalink
Browse files

TodoAppTest (一啟動顯示 3 筆 task)

  • Loading branch information...
1 parent 853c57d commit 74eb13230560e0e0fde268238df7e8c52de2b620 Sam.IO.Hsiao committed Oct 18, 2016
Showing with 39 additions and 0 deletions.
  1. +39 −0 tests/TodoAppTest.php
View
@@ -0,0 +1,39 @@
+<?php
+
+declare(strict_types = 1);
+
+use App\Task;
+
+class TodoAppTest extends TestCase
+{
+ /** @var string */
+ private $rootURL = 'todo';
+
+ protected function tearDown()
+ {
+ DB::table('tasks')->truncate();
+ parent::tearDown();
+ }
+
+ /** @test */
+ public function 一啟動顯示3筆task()
+ {
+ factory(Task::class)->create(['name' => 'Task 1']);
+ factory(Task::class)->create(['name' => 'Task 2']);
+ factory(Task::class)->create(['name' => 'Task 3']);
+
+ $this->visit($this->rootURL)
+ ->see('Task 1')
+ ->see('Task 2')
+ ->see('Task 3')
+ ->seeInDatabase('tasks', [
+ 'name' => 'Task 1',
+ ])
+ ->seeInDatabase('tasks', [
+ 'name' => 'Task 2',
+ ])
+ ->seeInDatabase('tasks', [
+ 'name' => 'Task 3',
+ ]);
+ }
+}

0 comments on commit 74eb132

Please sign in to comment.