Files
e-cosplay/tests/Attribute/MainframeTest.php
2025-07-16 12:04:44 +02:00

78 lines
2.2 KiB
PHP

<?php
namespace App\Tests\Attribute;
use App\Attribute\Mainframe;
use PHPUnit\Framework\TestCase;
class MainframeTest extends TestCase
{
/**
* Tests the default values of the Mainframe attribute.
*/
public function testDefaultValues(): void
{
$attribute = new Mainframe();
// Assert that default values are as expected
$this->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);
}
}