wip testing

This commit is contained in:
hackerESQ
2024-09-06 19:39:04 -05:00
parent 9a99686db1
commit 90262abffb
19 changed files with 193 additions and 92 deletions
@@ -1,6 +1,6 @@
<?php
namespace Tests\Feature;
namespace Tests;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -20,7 +20,7 @@ class ApiTokenPermissionsTest extends TestCase
// $this->markTestSkipped('API support is not enabled.');
// }
// $this->actingAs($user = User::factory()->withPersonalTeam()->create());
// $this->actingAs($user = User::factory()->create());
// $token = $user->tokens()->create([
// 'name' => 'Test Token',
@@ -41,7 +41,7 @@ class ApiTokenPermissionsTest extends TestCase
// $this->markTestSkipped('API support is not enabled.');
// }
// $this->actingAs($user = User::factory()->withPersonalTeam()->create());
// $this->actingAs($user = User::factory()->create());
// Livewire::test(ApiTokenManager::class)
// ->set(['createApiTokenForm' => [
@@ -65,7 +65,7 @@ class ApiTokenPermissionsTest extends TestCase
// $this->markTestSkipped('API support is not enabled.');
// }
// $this->actingAs($user = User::factory()->withPersonalTeam()->create());
// $this->actingAs($user = User::factory()->create());
// $token = $user->tokens()->create([
// 'name' => 'Test Token',
@@ -1,6 +1,6 @@
<?php
namespace Tests\Feature;
namespace Tests;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -1,6 +1,6 @@
<?php
namespace Tests\Feature;
namespace Tests;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -1,6 +1,6 @@
<?php
namespace Tests\Feature;
namespace Tests;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -1,6 +1,6 @@
<?php
namespace Tests\Feature;
namespace Tests;
use App\Models\User;
use Illuminate\Auth\Events\Verified;
@@ -20,7 +20,7 @@ class EmailVerificationTest extends TestCase
$this->markTestSkipped('Email verification not enabled.');
}
$user = User::factory()->withPersonalTeam()->unverified()->create();
$user = User::factory()->unverified()->create();
$response = $this->actingAs($user)->get('/email/verify');
-19
View File
@@ -1,19 +0,0 @@
<?php
namespace Tests\Feature;
// use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*/
public function test_the_application_returns_a_successful_response(): void
{
$response = $this->get('/');
$response->assertStatus(200);
}
}
@@ -1,6 +1,6 @@
<?php
namespace Tests\Feature;
namespace Tests;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -12,7 +12,7 @@ class PasswordConfirmationTest extends TestCase
public function test_confirm_password_screen_can_be_rendered(): void
{
$user = User::factory()->withPersonalTeam()->create();
$user = User::factory()->create();
$response = $this->actingAs($user)->get('/user/confirm-password');
@@ -1,6 +1,6 @@
<?php
namespace Tests\Feature;
namespace Tests;
use App\Models\User;
use Illuminate\Auth\Notifications\ResetPassword;
@@ -1,6 +1,6 @@
<?php
namespace Tests\Feature;
namespace Tests;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -1,6 +1,6 @@
<?php
namespace Tests\Feature;
namespace Tests;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Fortify\Features;
@@ -22,17 +22,6 @@ class RegistrationTest extends TestCase
$response->assertStatus(200);
}
// public function test_registration_screen_cannot_be_rendered_if_support_is_disabled(): void
// {
// if (Features::enabled(Features::registration())) {
// $this->markTestSkipped('Registration support is enabled.');
// }
// $response = $this->get('/register');
// $response->assertStatus(404);
// }
public function test_new_users_can_register(): void
{
if (! Features::enabled(Features::registration())) {
+14 -1
View File
@@ -2,9 +2,22 @@
namespace Tests;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
//
protected function setUp(): void
{
parent::setUp();
Artisan::call('migrate');
}
protected function tearDown(): void
{
parent::tearDown();
//
}
}
+73
View File
@@ -0,0 +1,73 @@
<?php
namespace Tests;
use App\Models\User;
use App\Models\Portfolio;
use App\Models\Transaction;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class TransactionsTest extends TestCase
{
use RefreshDatabase;
/**
* A basic test example.
*/
public function test_can_create_a_transaction(): void
{
$user = User::factory()->create();
$this->actingAs($user);
$transactions = Transaction::factory()->create();
}
}
// static::saving(function ($transaction) {
// if ($transaction->transaction_type == 'SELL') {
// $transaction->ensureCostBasisIsAddedToSale();
// }
// });
// static::saved(function ($transaction) {
// $transaction->syncToHolding();
// $transaction->refreshMarketData();
// cache()->tags(['metrics', $transaction->portfolio_id])->flush();
// });
// public function update()
// {
// $this->transaction->update($this->validate());
// // $this->transaction->owner_id = auth()->user()->id;
// $this->transaction->save();
// $this->success(__('Transaction updated'));
// $this->dispatch('toggle-manage-transaction');
// $this->dispatch('transaction-updated');
// }
// public function save()
// {
// $validated = $this->validate();
// if (!isset($this->portfolio)) {
// $this->portfolio = Portfolio::find($this->portfolio_id);
// }
// $transaction = $this->portfolio->transactions()->create($validated);
// $transaction->save();
// $this->dispatch('transaction-saved');
// $this->success(__('Transaction created'), redirectTo: route('holding.show', ['portfolio' => $this->portfolio->id, 'symbol' => $this->symbol]));
// }
@@ -1,6 +1,6 @@
<?php
namespace Tests\Feature;
namespace Tests;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
-16
View File
@@ -1,16 +0,0 @@
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*/
public function test_that_true_is_true(): void
{
$this->assertTrue(true);
}
}
@@ -1,6 +1,6 @@
<?php
namespace Tests\Feature;
namespace Tests;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;