Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

Commit 1c8a868

Browse files
committed
add the new test files (newly added to the framework
1 parent b66202b commit 1c8a868

File tree

4 files changed

+55
-24
lines changed

4 files changed

+55
-24
lines changed

tests/CreatesApplication.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
}
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
<?php
22

3+
namespace Tests\Feature;
4+
5+
use Tests\TestCase;
36
use Illuminate\Foundation\Testing\WithoutMiddleware;
47
use Illuminate\Foundation\Testing\DatabaseMigrations;
58
use Illuminate\Foundation\Testing\DatabaseTransactions;
69

710
class ExampleTest extends TestCase
811
{
912
/**
10-
* A basic functional test example.
13+
* A basic test example.
1114
*
1215
* @return void
1316
*/
14-
public function testBasicExample()
17+
public function testBasicTest()
1518
{
16-
$this->visit('/')
17-
->see('Laravel');
19+
$response = $this->get('/');
20+
21+
$response->assertStatus(200);
1822
}
1923
}

tests/TestCase.php

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
11
<?php
22

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;
204

21-
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
5+
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
226

23-
return $app;
24-
}
7+
abstract class TestCase extends BaseTestCase
8+
{
9+
use CreatesApplication;
2510
}

tests/Unit/ExampleTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
}

0 commit comments

Comments
 (0)