From 6756e79bf19a5d3c0d61f1c161ef13af127b5ccb Mon Sep 17 00:00:00 2001 From: Claudio Zizza Date: Fri, 24 Jan 2025 00:33:05 +0100 Subject: [PATCH] Remove code path usage from projects --- lib/DataSources/DbPrefill/Projects.php | 2 -- lib/Model/Project.php | 7 ------- lib/Projects/ProjectDataReader.php | 6 ------ tests/DataSources/DbPrefill/ProjectsTest.php | 1 - tests/DataSources/DbPrefill/fixtures/projects.json | 1 - tests/Projects/ProjectDataReaderTest.php | 2 -- tests/Projects/ProjectTest.php | 6 ------ tests/TestCase.php | 1 - tests/test-cache/data/projects.json | 3 --- 9 files changed, 29 deletions(-) diff --git a/lib/DataSources/DbPrefill/Projects.php b/lib/DataSources/DbPrefill/Projects.php index 1a5e11b3..b0fe200e 100644 --- a/lib/DataSources/DbPrefill/Projects.php +++ b/lib/DataSources/DbPrefill/Projects.php @@ -45,7 +45,6 @@ private function buildAndSaveProject(array $projectData): void $integrationFor = (string) ($projectData['integrationFor'] ?? ''); $docsRepositoryName = (string) ($projectData['docsRepositoryName'] ?? $repositoryName); $docsPath = (string) ($projectData['docsPath'] ?? '/docs'); - $codePath = (string) ($projectData['codePath'] ?? '/lib'); $description = (string) ($projectData['description'] ?? ''); $keywords = $projectData['keywords'] ?? []; @@ -106,7 +105,6 @@ private function buildAndSaveProject(array $projectData): void $integrationFor, $docsRepositoryName, $docsPath, - $codePath, $description, $projectIntegrationType, $integration, diff --git a/lib/Model/Project.php b/lib/Model/Project.php index 58d0d06a..7a615b18 100644 --- a/lib/Model/Project.php +++ b/lib/Model/Project.php @@ -49,8 +49,6 @@ public function __construct( #[ORM\Column(type: 'string')] private string $docsPath, #[ORM\Column(type: 'string')] - private string $codePath, - #[ORM\Column(type: 'string')] private string $description, #[ORM\OneToOne(targetEntity: ProjectIntegrationType::class, fetch: 'EAGER', orphanRemoval: true)] #[ORM\JoinColumn(name: 'projectIntegrationType', referencedColumnName: 'id', nullable: true)] @@ -137,11 +135,6 @@ public function getDocsPath(): string return $this->docsPath; } - public function getCodePath(): string - { - return $this->codePath; - } - public function getDescription(): string { return $this->description; diff --git a/lib/Projects/ProjectDataReader.php b/lib/Projects/ProjectDataReader.php index 12b7bf2e..11ed33e5 100644 --- a/lib/Projects/ProjectDataReader.php +++ b/lib/Projects/ProjectDataReader.php @@ -87,7 +87,6 @@ private function createDefaultProjectData(string $repositoryName): array 'name' => $repositoryName, 'repositoryName' => $repositoryName, 'docsPath' => $this->detectDocsPath($repositoryName), - 'codePath' => $this->detectCodePath($repositoryName), 'slug' => $slug, 'versions' => [ [ @@ -120,11 +119,6 @@ private function detectDocsPath(string $repositoryName): string|null return $this->detectPath($repositoryName, ['/docs', '/doc', '/Resources/doc', '/source'], null); } - private function detectCodePath(string $repositoryName): string|null - { - return $this->detectPath($repositoryName, ['/src', '/lib'], '/'); - } - /** @param string[] $pathsToCheck */ private function detectPath(string $repositoryName, array $pathsToCheck, string|null $default): string|null { diff --git a/tests/DataSources/DbPrefill/ProjectsTest.php b/tests/DataSources/DbPrefill/ProjectsTest.php index bdda7f12..8f5e93cd 100644 --- a/tests/DataSources/DbPrefill/ProjectsTest.php +++ b/tests/DataSources/DbPrefill/ProjectsTest.php @@ -79,7 +79,6 @@ private function assertProjectIsComplete(EntityManagerInterface $entityManager): self::assertSame('doctrine-testproject', $project->getDocsSlug()); self::assertSame('testproject', $project->getDocsRepositoryName()); self::assertSame('/docs', $project->getDocsPath()); - self::assertSame('/lib', $project->getCodePath()); self::assertSame('doctrine/testproject', $project->getComposerPackageName()); self::assertSame('testproject', $project->getRepositoryName()); self::assertFalse($project->isIntegration()); diff --git a/tests/DataSources/DbPrefill/fixtures/projects.json b/tests/DataSources/DbPrefill/fixtures/projects.json index 2f4616d0..e5ceb2fb 100644 --- a/tests/DataSources/DbPrefill/fixtures/projects.json +++ b/tests/DataSources/DbPrefill/fixtures/projects.json @@ -6,7 +6,6 @@ "name": "Testproject", "repositoryName": "testproject", "docsPath": "/docs", - "codePath": "/lib", "slug": "testproject", "versionsGreaterThan": "1.0.1", "versions": [ diff --git a/tests/Projects/ProjectDataReaderTest.php b/tests/Projects/ProjectDataReaderTest.php index d2b450a4..8ff49517 100644 --- a/tests/Projects/ProjectDataReaderTest.php +++ b/tests/Projects/ProjectDataReaderTest.php @@ -21,7 +21,6 @@ public function testRead(): void 'name' => 'test-project', 'repositoryName' => 'test-project', 'docsPath' => '/docs', - 'codePath' => '/src', 'slug' => 'test-project', 'versions' => [ [ @@ -48,7 +47,6 @@ public function testReadFileDoesNotExist(): void 'repositoryName' => 'no-project-json', 'name' => 'no-project-json', 'docsPath' => null, - 'codePath' => '/', 'slug' => 'no-project-json', 'versions' => [ [ diff --git a/tests/Projects/ProjectTest.php b/tests/Projects/ProjectTest.php index b91250db..cdb59ddd 100644 --- a/tests/Projects/ProjectTest.php +++ b/tests/Projects/ProjectTest.php @@ -27,7 +27,6 @@ protected function setUp(): void 'repositoryName' => 'test-project', 'docsRepositoryName' => 'test-project', 'docsPath' => '/docs', - 'codePath' => '/src', 'description' => 'Test description.', 'keywords' => ['keyword1', 'keyword2'], 'versions' => new ArrayCollection([ @@ -92,11 +91,6 @@ public function testGetDocsPath(): void self::assertSame('/docs', $this->project->getDocsPath()); } - public function testGetCodePath(): void - { - self::assertSame('/src', $this->project->getCodePath()); - } - public function testGetDescription(): void { self::assertSame('Test description.', $this->project->getDescription()); diff --git a/tests/TestCase.php b/tests/TestCase.php index 32c1338b..ca41910a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -42,7 +42,6 @@ protected function createProject(array $data): Project 'integrationFor' => '', 'docsRepositoryName' => '', 'docsPath' => '', - 'codePath' => '', 'description' => '', 'projectIntegrationType' => null, 'integration' => true, diff --git a/tests/test-cache/data/projects.json b/tests/test-cache/data/projects.json index 571cd5c7..f4ec20be 100644 --- a/tests/test-cache/data/projects.json +++ b/tests/test-cache/data/projects.json @@ -6,7 +6,6 @@ "name": "Object Relational Mapper", "repositoryName": "orm", "docsPath": "/docs", - "codePath": "/lib", "slug": "orm", "versions": [ { @@ -390,7 +389,6 @@ "name": "Database Abstraction Layer", "repositoryName": "dbal", "docsPath": "/docs", - "codePath": "/src", "slug": "dbal", "versions": [ { @@ -713,7 +711,6 @@ "name": "Annotations", "repositoryName": "annotations", "docsPath": "/docs", - "codePath": "/lib", "slug": "annotations", "versions": [ {