This repository was archived by the owner on Dec 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +55
-24
lines changed Expand file tree Collapse file tree 4 files changed +55
-24
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tests ;
4
+
5
+ use Illuminate \Contracts \Console \Kernel ;
6
+
7
+ trait CreatesApplication
8
+ {
9
+ /**
10
+ * Creates the application.
11
+ *
12
+ * @return \Illuminate\Foundation\Application
13
+ */
14
+ public function createApplication ()
15
+ {
16
+ $ app = require __DIR__ .'/../bootstrap/app.php ' ;
17
+
18
+ $ app ->make (Kernel::class)->bootstrap ();
19
+
20
+ return $ app ;
21
+ }
22
+ }
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
+ namespace Tests \Feature ;
4
+
5
+ use Tests \TestCase ;
3
6
use Illuminate \Foundation \Testing \WithoutMiddleware ;
4
7
use Illuminate \Foundation \Testing \DatabaseMigrations ;
5
8
use Illuminate \Foundation \Testing \DatabaseTransactions ;
6
9
7
10
class ExampleTest extends TestCase
8
11
{
9
12
/**
10
- * A basic functional test example.
13
+ * A basic test example.
11
14
*
12
15
* @return void
13
16
*/
14
- public function testBasicExample ()
17
+ public function testBasicTest ()
15
18
{
16
- $ this ->visit ('/ ' )
17
- ->see ('Laravel ' );
19
+ $ response = $ this ->get ('/ ' );
20
+
21
+ $ response ->assertStatus (200 );
18
22
}
19
23
}
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- abstract class TestCase extends Illuminate \Foundation \Testing \TestCase
4
- {
5
- /**
6
- * The base URL to use while testing the application.
7
- *
8
- * @var string
9
- */
10
- protected $ baseUrl = 'http://localhost ' ;
11
-
12
- /**
13
- * Creates the application.
14
- *
15
- * @return \Illuminate\Foundation\Application
16
- */
17
- public function createApplication ()
18
- {
19
- $ app = require __DIR__ .'/../bootstrap/app.php ' ;
3
+ namespace Tests ;
20
4
21
- $ app -> make ( Illuminate \Contracts \ Console \Kernel::class)-> bootstrap () ;
5
+ use Illuminate \Foundation \ Testing \ TestCase as BaseTestCase ;
22
6
23
- return $ app ;
24
- }
7
+ abstract class TestCase extends BaseTestCase
8
+ {
9
+ use CreatesApplication;
25
10
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tests \Unit ;
4
+
5
+ use Tests \TestCase ;
6
+ use Illuminate \Foundation \Testing \DatabaseMigrations ;
7
+ use Illuminate \Foundation \Testing \DatabaseTransactions ;
8
+
9
+ class ExampleTest extends TestCase
10
+ {
11
+ /**
12
+ * A basic test example.
13
+ *
14
+ * @return void
15
+ */
16
+ public function testBasicTest ()
17
+ {
18
+ $ this ->assertTrue (true );
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments