Changed phpunit.xml config and removed non working test

Changed phpunit.xml config and removed non working test
This commit is contained in:
RamonRobben 2021-06-06 14:21:16 +02:00 committed by GitHub
commit 2d4fd6846d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 74 deletions

View file

@ -5,11 +5,8 @@
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
<testsuite name="Tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">

View file

@ -1,69 +0,0 @@
<?php
namespace Tests\Feature;
use App\Models\DiscordUser;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ApiVerifyDiscordTest extends TestCase
{
use RefreshDatabase;
/**
* A basic feature test example.
*
* @return void
*/
public function test_verify_without_params()
{
$this->postJson('/api/verify')->assertStatus(422);
}
public function test_verify_with_invalid_user_id()
{
$this->postJson('/api/verify', [
'user_id' => rand(10000000, 100000000)
])->assertStatus(422)->assertJsonValidationErrors('user_id');
}
public function test_verify_with_valid_discord_user_id_but_with_invalid_user_id()
{
$discordUser = DiscordUser::factory()->create([
'user_id' => 9999999999999
]);
$this->postJson('/api/verify', [
'user_id' => $discordUser->id
])->assertStatus(422)->assertJsonValidationErrors('user_id');
}
public function test_verify_with_valid_discord_user_id_with_valid_user_id()
{
$discordUser = DiscordUser::factory()->create();
$this->postJson('/api/verify', [
'user_id' => $discordUser->id
])->assertStatus(200);
$this->assertEquals((250 + 375), User::find($discordUser->user->id)->credits);
$this->assertEquals(3, User::find($discordUser->user->id)->server_limit);
}
public function test_verify_second_time_should_not_work()
{
$discordUser = DiscordUser::factory()->create();
$this->postJson('/api/verify', [
'user_id' => $discordUser->id
])->assertStatus(200);
$this->postJson('/api/verify', [
'user_id' => $discordUser->id
])->assertStatus(422)->assertJsonValidationErrors('user_id');
$this->assertEquals((250 + 375), User::find($discordUser->user->id)->credits);
$this->assertEquals(3, User::find($discordUser->user->id)->server_limit);
}
}

View file

@ -0,0 +1,14 @@
<?php
namespace Tests\Unit;
use Tests\TestCase;
class exampleTest extends TestCase
{
public function test_example(): void
{
$response = $this->get('/');
$response->assertStatus(302);
}
}