diff --git a/.gitignore b/.gitignore index 179eef5..11ed85a 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,5 @@ phpstan.neon /public/media/cache/ ###< liip/imagine-bundle ### .coverage +coverage/ .phpunit.cache diff --git a/docker-compose.yml b/docker-compose.yml index 9a77649..7d1693d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,6 +20,7 @@ services: # Monte le socket Docker pour permettre l'exécution de commandes docker depuis le conteneur - /var/run/docker.sock:/var/run/docker.sock - ./coverage:/opt/phpstorm-coverage + - ./.coverage:/opt/phpstorm-coverage depends_on: # S'assure que la base de données et Redis sont démarrés avant PHP - db diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index 2a6d461..e45e8e1 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -77,6 +77,7 @@ RUN mkdir -p /opt/phpstorm-coverage && \ # Installer Composer globalement COPY --from=composer:latest /usr/bin/composer /usr/bin/composer +RUN mkdir -p /opt/phpstorm-coverage/ && chmod -R 777 /opt/phpstorm-coverage/ # Créer un utilisateur et un groupe non-root pour l'application # Utilisation de useradd/groupadd pour les systèmes basés sur Debian/Ubuntu @@ -85,6 +86,5 @@ RUN groupadd -g $GID appuser && \ # Changer pour l'utilisateur non-root USER appuser - # Définir le répertoire de travail WORKDIR /srv/app diff --git a/src/Attribute/Mainframe.php b/src/Attribute/Mainframe.php new file mode 100644 index 0000000..35a1358 --- /dev/null +++ b/src/Attribute/Mainframe.php @@ -0,0 +1,21 @@ +json([]); - } } diff --git a/tests/Attribute/MainframeTest.php b/tests/Attribute/MainframeTest.php new file mode 100644 index 0000000..94ad974 --- /dev/null +++ b/tests/Attribute/MainframeTest.php @@ -0,0 +1,77 @@ +assertFalse($attribute->index); + $this->assertFalse($attribute->sitemap); + $this->assertNull($attribute->sitemapPage); + } + + /** + * Tests the Mainframe attribute with custom values. + */ + public function testCustomValues(): void + { + $attribute = new Mainframe( + index: true, + sitemap: true, + sitemapPage: 'about-us' + ); + + // Assert that custom values are correctly set + $this->assertTrue($attribute->index); + $this->assertTrue($attribute->sitemap); + $this->assertEquals('about-us', $attribute->sitemapPage); + } + + /** + * Tests the Mainframe attribute with only 'index' set to true. + */ + public function testIndexOnly(): void + { + $attribute = new Mainframe(index: true); + + // Assert 'index' is true, others are default + $this->assertTrue($attribute->index); + $this->assertFalse($attribute->sitemap); + $this->assertNull($attribute->sitemapPage); + } + + /** + * Tests the Mainframe attribute with only 'sitemap' set to true. + */ + public function testSitemapOnly(): void + { + $attribute = new Mainframe(sitemap: true); + + // Assert 'sitemap' is true, others are default + $this->assertFalse($attribute->index); + $this->assertTrue($attribute->sitemap); + $this->assertNull($attribute->sitemapPage); + } + + /** + * Tests the Mainframe attribute with 'sitemapPage' set. + */ + public function testSitemapPageOnly(): void + { + $attribute = new Mainframe(sitemapPage: 'contact'); + + // Assert 'sitemapPage' is set, others are default + $this->assertFalse($attribute->index); + $this->assertFalse($attribute->sitemap); + $this->assertEquals('contact', $attribute->sitemapPage); + } +}