Files
Mangarr/tests/Domain/Manga/Application/Command/ToggleMangaMonitoringTest.php

47 lines
1.3 KiB
PHP

<?php
namespace App\Tests\Domain\Manga\Application\Command;
use App\Domain\Manga\Application\Command\ToggleMangaMonitoring;
use App\Domain\Manga\Domain\Model\ValueObject\MangaId;
use PHPUnit\Framework\TestCase;
class ToggleMangaMonitoringTest extends TestCase
{
public function testCreateCommandWithValidData(): void
{
// Arrange & Act
$mangaId = new MangaId('manga-123');
$enabled = true;
$command = new ToggleMangaMonitoring($mangaId, $enabled);
// Assert
$this->assertEquals($mangaId, $command->mangaId);
$this->assertTrue($command->enabled);
}
public function testCreateCommandWithDisabled(): void
{
// Arrange & Act
$mangaId = new MangaId('manga-456');
$enabled = false;
$command = new ToggleMangaMonitoring($mangaId, $enabled);
// Assert
$this->assertEquals($mangaId, $command->mangaId);
$this->assertFalse($command->enabled);
}
public function testCommandIsReadonly(): void
{
// Arrange
$command = new ToggleMangaMonitoring(new MangaId('manga-123'), true);
// Act & Assert - Tenter de modifier les propriétés devrait être impossible
$reflection = new \ReflectionClass($command);
$this->assertTrue($reflection->isReadOnly());
}
}