update wuerry
All checks were successful
All checks were successful
This commit is contained in:
59
tests/Feature/PostgresCompatibilityTest.php
Normal file
59
tests/Feature/PostgresCompatibilityTest.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PostgresCompatibilityTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test compatibility of major reports and dashboards with PostgreSQL.
|
||||
*/
|
||||
public function test_reports_and_dashboards_compatibility()
|
||||
{
|
||||
$user = User::where('email', 'dapurhoney@honey.com')->first();
|
||||
|
||||
if (!$user) {
|
||||
$this->markTestSkipped('Test user not found.');
|
||||
}
|
||||
|
||||
$this->actingAs($user);
|
||||
|
||||
$routes = [
|
||||
'business.dashboard.index',
|
||||
'business.dashboard.data',
|
||||
'business.dashboard.revenue',
|
||||
'business.vat-reports.index',
|
||||
'business.loss-profit-history.index',
|
||||
'business.loss-profit-history-reports.index',
|
||||
];
|
||||
|
||||
foreach ($routes as $routeName) {
|
||||
$response = $this->get(route($routeName));
|
||||
|
||||
// We expect 200, but some might require parameters.
|
||||
// The main goal is to catch SQLSTATE[42703] or similar Postgres errors (500).
|
||||
$this->assertNotEquals(500, $response->getStatusCode(), "Route $routeName failed with status " . $response->getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test dueForBranch method on Party model.
|
||||
*/
|
||||
public function test_party_due_for_branch_method()
|
||||
{
|
||||
$user = User::where('email', 'dapurhoney@honey.com')->first();
|
||||
if (!$user) $this->markTestSkipped('Test user not found.');
|
||||
|
||||
$this->actingAs($user);
|
||||
|
||||
// Test the routes that were crashing
|
||||
$response1 = $this->get(route('business.sales.create'));
|
||||
$this->assertNotEquals(500, $response1->getStatusCode(), "Sales create crashed.");
|
||||
|
||||
$response2 = $this->get(route('business.purchases.create'));
|
||||
$this->assertNotEquals(500, $response2->getStatusCode(), "Purchases create crashed.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user