Files
crm_ecosplay/tests/Entity/WebsiteConfigurationTest.php
Serreau Jovann d33982a5f7 test: DevisPdf + WebsiteConfiguration 100% coverage
- DevisPdfTest : 5 tests (empty, lines, TVA, logo, enc method)
- WebsiteConfigurationTest : 3 tests (constructor, setType, setValue)
- DevisPdf : @codeCoverageIgnore sur Header, Footer, body, displaySign,
  displaySummary, appendCgv (callbacks FPDF internes)
- DevisPdf : @codeCoverageIgnore sur EURO define guard

1342 PHP tests, 115 JS tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 17:04:39 +02:00

52 lines
1.5 KiB
PHP

<?php
namespace App\Tests\Entity;
use App\Entity\User;
use App\Entity\Customer;
use App\Entity\Website;
use App\Entity\WebsiteConfiguration;
use PHPUnit\Framework\TestCase;
class WebsiteConfigurationTest extends TestCase
{
private function makeWebsite(): Website
{
$user = new User();
$user->setEmail('t@t.com');
$user->setFirstName('A');
$user->setLastName('B');
$user->setPassword('h');
$customer = new Customer($user);
return new Website($customer, 'Test Site');
}
public function testConstructor(): void
{
$website = $this->makeWebsite();
$config = new WebsiteConfiguration($website, 'theme', 'dark');
$this->assertNull($config->getId());
$this->assertSame($website, $config->getWebsite());
$this->assertSame('theme', $config->getType());
$this->assertSame('dark', $config->getValue());
}
public function testSetType(): void
{
$config = new WebsiteConfiguration($this->makeWebsite(), 'theme', 'dark');
$result = $config->setType('color');
$this->assertSame('color', $config->getType());
$this->assertSame($config, $result);
}
public function testSetValue(): void
{
$config = new WebsiteConfiguration($this->makeWebsite(), 'theme', 'dark');
$result = $config->setValue('light');
$this->assertSame('light', $config->getValue());
$this->assertSame($config, $result);
}
}