Stout halfling cleric, level 2, Hermit, played by Adriaan. His sheet is still sparse (no domain, level 1 spells, features or personality yet), so this is what's on it so far. AC 16 reads the sheet's "14+2" as scale mail plus a shield that isn't on the equipment list yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.6 KiB
PHP
44 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Tests\Character;
|
|
|
|
use App\Command\SeedCharactersCommand;
|
|
use App\Entity\Character;
|
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|
|
|
/**
|
|
* Every ready-made sheet in app:character:seed must hydrate into a Character
|
|
* that passes validation - a typo'd field name or an over-long value would
|
|
* otherwise only surface when someone runs the command on testing/live.
|
|
*/
|
|
class SeedCharactersCatalogTest extends KernelTestCase
|
|
{
|
|
public function testEveryCatalogSheetHydratesIntoAValidCharacter(): void
|
|
{
|
|
self::bootKernel();
|
|
$command = self::getContainer()->get(SeedCharactersCommand::class);
|
|
$validator = self::getContainer()->get(ValidatorInterface::class);
|
|
|
|
$sheets = (new \ReflectionMethod($command, 'sheets'))->invoke($command);
|
|
$hydrate = new \ReflectionMethod($command, 'hydrate');
|
|
|
|
$names = array_column($sheets, 'name');
|
|
self::assertSame(['Darragh Fermwyr', 'Owayn Fermwyr', 'Dunnchadh', 'Aoife Fermwyr', 'Ruadhri'], $names);
|
|
|
|
foreach ($sheets as $row) {
|
|
/** @var Character $c */
|
|
$c = $hydrate->invoke($command, $row);
|
|
$violations = $validator->validate($c);
|
|
self::assertCount(0, $violations, $row['name'].': '.$violations);
|
|
|
|
foreach ($c->getSkillProficiencies() as $skill) {
|
|
self::assertArrayHasKey($skill, Character::SKILLS, $row['name']);
|
|
}
|
|
foreach ($c->getSavingThrowProficiencies() as $ability) {
|
|
self::assertContains($ability, Character::ABILITIES, $row['name']);
|
|
}
|
|
}
|
|
}
|
|
}
|