Skip to content

Commit ed4895c

Browse files
committed
Pre-work (part 3/3): Restructure tests folder
Since we'll have Vue tests in this project, I changed the tests folder structure to tests/php/(unit|feature) and tests/js/(unit|feature). - The namespaces of the test classes have been updated to follow PSR-4 standards: For example: "namespace Tests\Feature;" became "namespace Tests\Php\Feature;" - Add method return type-hint to the test methods
1 parent c826444 commit ed4895c

File tree

9 files changed

+50
-65
lines changed

9 files changed

+50
-65
lines changed

phpunit.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
stopOnFailure="false">
1111
<testsuites>
1212
<testsuite name="Unit">
13-
<directory suffix="Test.php">./tests/Unit</directory>
13+
<directory suffix="Test.php">./tests/php/Unit</directory>
1414
</testsuite>
1515

1616
<testsuite name="Feature">
17-
<directory suffix="Test.php">./tests/Feature</directory>
17+
<directory suffix="Test.php">./tests/php/Feature</directory>
1818
</testsuite>
1919
</testsuites>
2020
<filter>

tests/CreatesApplication.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/Feature/ExampleTest.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/Unit/ExampleTest.php

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Nothing in here yet :(

tests/php/CreatesApplication.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Tests\php;
4+
5+
use Illuminate\Contracts\Console\Kernel;
6+
use Illuminate\Foundation\Application;
7+
8+
trait CreatesApplication
9+
{
10+
public function createApplication(): Application
11+
{
12+
$app = require __DIR__.'/../../bootstrap/app.php';
13+
14+
$app->make(Kernel::class)->bootstrap();
15+
16+
return $app;
17+
}
18+
}

tests/php/Feature/ExampleTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Tests\php\Feature;
4+
5+
use Tests\php\TestCase;
6+
7+
class ExampleTest extends TestCase
8+
{
9+
public function testBasicTest(): void
10+
{
11+
$response = $this->get('/');
12+
13+
$response->assertStatus(200);
14+
}
15+
}

tests/TestCase.php renamed to tests/php/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Tests;
3+
namespace Tests\php;
44

55
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
66

tests/php/Unit/ExampleTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Tests\php\Unit;
4+
5+
use Tests\php\TestCase;
6+
7+
class ExampleTest extends TestCase
8+
{
9+
public function testBasicTest(): void
10+
{
11+
$this->assertTrue(true);
12+
}
13+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy