assertTranslationsComplete($this->moduleName); } public function testRoutesExist(): void { $this->assertRouteExists('GET', '/admin/companies'); $this->assertRouteExists('GET', '/admin/companies/create'); $this->assertRouteExists('POST', '/admin/companies/store'); $this->assertRouteExists('GET', '/admin/companies/edit/{id}'); $this->assertRouteExists('POST', '/admin/companies/update/{id}'); $this->assertRouteExists('GET', '/admin/companies/delete/{id}'); $this->assertRouteExists('GET', '/admin/companies/{id}'); } public function testStorageRouteExists(): void { $this->assertRouteExists('GET', '/storage/uploads/{module}/{filename}'); } public function testCompanyModelTable(): void { $company = new Company(); $this->assertEquals('bus', $company->getTable()); } public function testCompanyModelHasUploadFields(): void { $company = new Company(); $fillable = $company->getFillable(); $this->assertContains('bus_logo', $fillable); $this->assertContains('bus_business_card', $fillable); $this->assertContains('bus_document', $fillable); } public function testCompanyModelHasUrlAccessors(): void { $company = new Company(); // Use reflection to check if methods exist $reflection = new \ReflectionClass($company); $this->assertTrue($reflection->hasMethod('getLogoUrlAttribute')); $this->assertTrue($reflection->hasMethod('getBusinessCardUrlAttribute')); $this->assertTrue($reflection->hasMethod('getDocumentUrlAttribute')); } public function testUploadDirectoriesExist(): void { $baseDir = dirname(__DIR__, 4) . '/storage/uploads/company/'; $this->assertTrue(is_dir($baseDir . 'logos')); $this->assertTrue(is_dir($baseDir . 'business-cards')); $this->assertTrue(is_dir($baseDir . 'documents')); } public function testUploadDirectoriesAreWritable(): void { $baseDir = dirname(__DIR__, 4) . '/storage/uploads/company/'; $this->assertTrue(is_writable($baseDir . 'logos')); $this->assertTrue(is_writable($baseDir . 'business-cards')); $this->assertTrue(is_writable($baseDir . 'documents')); } public function testLogoUrlAccessorReturnsCorrectPath(): void { $company = new Company(); $company->bus_logo = 'test_logo.jpg'; $url = $company->logo_url; $this->assertStringContainsString('storage/uploads/company/logos/test_logo.jpg', $url); $this->assertStringStartsWith(url('/'), $url); } public function testBusinessCardUrlAccessorReturnsCorrectPath(): void { $company = new Company(); $company->bus_business_card = 'test_card.jpg'; $url = $company->business_card_url; $this->assertStringContainsString('storage/uploads/company/business-cards/test_card.jpg', $url); $this->assertStringStartsWith(url('/'), $url); } public function testDocumentUrlAccessorReturnsCorrectPath(): void { $company = new Company(); $company->bus_document = 'test_doc.pdf'; $url = $company->document_url; $this->assertStringContainsString('storage/uploads/company/documents/test_doc.pdf', $url); $this->assertStringStartsWith(url('/'), $url); } public function testCompanyControllerMethodsExist(): void { $view = new \Kernel\View(); $controller = new CompanyController($view); $reflection = new \ReflectionClass($controller); $this->assertTrue($reflection->hasMethod('index')); $this->assertTrue($reflection->hasMethod('create')); $this->assertTrue($reflection->hasMethod('store')); $this->assertTrue($reflection->hasMethod('show')); $this->assertTrue($reflection->hasMethod('edit')); $this->assertTrue($reflection->hasMethod('update')); $this->assertTrue($reflection->hasMethod('destroy')); } }