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."); } }