From 223cfe086c7db99643632f4057f6d1e03b5b14a9 Mon Sep 17 00:00:00 2001 From: Dayamond Date: Sat, 18 Oct 2025 17:17:35 +0200 Subject: [PATCH] Add Bruno tests --- tests/Create user.bru | 42 +++++++++++++++++++++++++++++++ tests/Feature/ExampleTest.php | 7 ------ tests/Pest.php | 47 ----------------------------------- tests/TestCase.php | 10 -------- tests/Unit/ExampleTest.php | 5 ---- tests/bruno.json | 9 +++++++ tests/hello.bru | 25 +++++++++++++++++++ 7 files changed, 76 insertions(+), 69 deletions(-) create mode 100644 tests/Create user.bru delete mode 100644 tests/Feature/ExampleTest.php delete mode 100644 tests/Pest.php delete mode 100644 tests/TestCase.php delete mode 100644 tests/Unit/ExampleTest.php create mode 100644 tests/bruno.json create mode 100644 tests/hello.bru diff --git a/tests/Create user.bru b/tests/Create user.bru new file mode 100644 index 0000000..cdb46a7 --- /dev/null +++ b/tests/Create user.bru @@ -0,0 +1,42 @@ +meta { + name: Create user + type: http + seq: 2 +} + +post { + url: http://localhost:8000/api/user/create + body: json + auth: inherit +} + +headers { + Accept: application/json +} + +body:json { + { + "name": "{{name}}", + "email": "{{email}}", + "password": "{{password}}" + } +} + +vars:pre-request { + name: name + email: test@test.com + password: test +} + +assert { + res.status: eq 200 +} + +settings { + encodeUrl: true + timeout: 0 +} + +docs { + Créer un utilisateur test +} diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php deleted file mode 100644 index 8fdc86b..0000000 --- a/tests/Feature/ExampleTest.php +++ /dev/null @@ -1,7 +0,0 @@ -get('/'); - - $response->assertStatus(200); -}); diff --git a/tests/Pest.php b/tests/Pest.php deleted file mode 100644 index 60f04a4..0000000 --- a/tests/Pest.php +++ /dev/null @@ -1,47 +0,0 @@ -extend(Tests\TestCase::class) - // ->use(Illuminate\Foundation\Testing\RefreshDatabase::class) - ->in('Feature'); - -/* -|-------------------------------------------------------------------------- -| Expectations -|-------------------------------------------------------------------------- -| -| When you're writing tests, you often need to check that values meet certain conditions. The -| "expect()" function gives you access to a set of "expectations" methods that you can use -| to assert different things. Of course, you may extend the Expectation API at any time. -| -*/ - -expect()->extend('toBeOne', function () { - return $this->toBe(1); -}); - -/* -|-------------------------------------------------------------------------- -| Functions -|-------------------------------------------------------------------------- -| -| While Pest is very powerful out-of-the-box, you may have some testing code specific to your -| project that you don't want to repeat in every file. Here you can also expose helpers as -| global functions to help you to reduce the number of lines of code in your test files. -| -*/ - -function something() -{ - // .. -} diff --git a/tests/TestCase.php b/tests/TestCase.php deleted file mode 100644 index fe1ffc2..0000000 --- a/tests/TestCase.php +++ /dev/null @@ -1,10 +0,0 @@ -toBeTrue(); -}); diff --git a/tests/bruno.json b/tests/bruno.json new file mode 100644 index 0000000..82c6e55 --- /dev/null +++ b/tests/bruno.json @@ -0,0 +1,9 @@ +{ + "version": "1", + "name": "test", + "type": "collection", + "ignore": [ + "node_modules", + ".git" + ] +} \ No newline at end of file diff --git a/tests/hello.bru b/tests/hello.bru new file mode 100644 index 0000000..470316b --- /dev/null +++ b/tests/hello.bru @@ -0,0 +1,25 @@ +meta { + name: hello + type: http + seq: 1 +} + +get { + url: http://localhost:8000/api/hello + body: none + auth: inherit +} + +assert { + res.status: eq 200 + res.body: eq Hello +} + +settings { + encodeUrl: true + timeout: 0 +} + +docs { + Permet de tester la route hello et verifier si le serveur laravel backend est bien allumé +}