Skip to content

Commit adf6a2e

Browse files
committed
first
Signed-off-by: Mior Muhammad Zaki <[email protected]>
0 parents  commit adf6a2e

File tree

7 files changed

+140
-0
lines changed

7 files changed

+140
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Composer
2+
/composer.lock
3+
/vendor/*
4+
5+
# PHPUnit
6+
/coverage/*
7+
/.phpunit.cache/*
8+
/.phpunit.result.cache
9+
/phpunit.xml

composer.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "https://getcomposer.org/schema.json",
3+
"name": "laravel/starter-kit-browser-tests",
4+
"description": "Browser Tests for Laravel Starter Kit",
5+
"type": "library",
6+
"license": "MIT",
7+
"keywords": ["dev"],
8+
"autoload": {
9+
"psr-4": {
10+
"Tests\\": "tests/"
11+
}
12+
},
13+
"require": {
14+
"php": "^8.3",
15+
"pestphp/pest": "^4.0"
16+
},
17+
"require-dev": {
18+
"laravel/vue-starter-kit": "^1.0.2",
19+
"orchestra/testbench-core": "^10.6.3"
20+
},
21+
"config": {
22+
"allow-plugins": {
23+
"pestphp/pest-plugin": true
24+
}
25+
},
26+
"minimum-stability": "dev",
27+
"prefer-stable": true
28+
}

phpunit.xml.dist

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
>
7+
<testsuites>
8+
<testsuite name="Unit">
9+
<directory>tests/Unit</directory>
10+
</testsuite>
11+
<testsuite name="Feature">
12+
<directory>tests/Feature</directory>
13+
</testsuite>
14+
</testsuites>
15+
<source>
16+
<include>
17+
<directory>app</directory>
18+
</include>
19+
</source>
20+
<php>
21+
<!-- <env name="APP_BASE_PATH" value="./vendor/orchestra/testbench-core/laravel"/> -->
22+
<env name="APP_ENV" value="testing"/>
23+
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
24+
<env name="BCRYPT_ROUNDS" value="4"/>
25+
<env name="CACHE_STORE" value="array"/>
26+
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
27+
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
28+
<env name="MAIL_MAILER" value="array"/>
29+
<env name="PULSE_ENABLED" value="false"/>
30+
<env name="QUEUE_CONNECTION" value="sync"/>
31+
<env name="SESSION_DRIVER" value="array"/>
32+
<env name="TELESCOPE_ENABLED" value="false"/>
33+
</php>
34+
</phpunit>

tests/Feature/ExampleTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
it('returns a successful response', function () {
4+
$response = $this->get('/');
5+
6+
$response->assertStatus(200);
7+
});

tests/Pest.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/*
4+
|--------------------------------------------------------------------------
5+
| Test Case
6+
|--------------------------------------------------------------------------
7+
|
8+
| The closure you provide to your test functions is always bound to a specific PHPUnit test
9+
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
10+
| need to change it using the "pest()" function to bind a different classes or traits.
11+
|
12+
*/
13+
14+
pest()->extend(Tests\TestCase::class)
15+
// ->use(Illuminate\Foundation\Testing\RefreshDatabase::class)
16+
->in('Feature');
17+
18+
/*
19+
|--------------------------------------------------------------------------
20+
| Expectations
21+
|--------------------------------------------------------------------------
22+
|
23+
| When you're writing tests, you often need to check that values meet certain conditions. The
24+
| "expect()" function gives you access to a set of "expectations" methods that you can use
25+
| to assert different things. Of course, you may extend the Expectation API at any time.
26+
|
27+
*/
28+
29+
expect()->extend('toBeOne', function () {
30+
return $this->toBe(1);
31+
});
32+
33+
/*
34+
|--------------------------------------------------------------------------
35+
| Functions
36+
|--------------------------------------------------------------------------
37+
|
38+
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
39+
| project that you don't want to repeat in every file. Here you can also expose helpers as
40+
| global functions to help you to reduce the number of lines of code in your test files.
41+
|
42+
*/
43+
44+
function something()
45+
{
46+
// ..
47+
}

tests/TestCase.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
6+
7+
abstract class TestCase extends BaseTestCase
8+
{
9+
//
10+
}

tests/Unit/ExampleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
test('that true is true', function () {
4+
expect(true)->toBeTrue();
5+
});

0 commit comments

Comments
 (0)