58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Blackbirdchess\Tests\Service\Import\Readers;
|
|
|
|
use Blackbirdchess\Service\Import\Readers\Swar5;
|
|
use Blackbirdchess\Service\Results\Enums\Title;
|
|
use Blackbirdchess\Service\Results\Player;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class Swar5Test extends TestCase
|
|
{
|
|
private string $swarfile = '/res/Swar5-testfile.swar';
|
|
private Swar5 $testobject;
|
|
|
|
public function setUp(): void
|
|
{
|
|
$this->swarfile = getcwd() . $this->swarfile;
|
|
$this->testobject = new Swar5();
|
|
$this->testobject->read($this->swarfile);
|
|
}
|
|
|
|
public function testReadTournamentName(): void
|
|
{
|
|
$this->assertEquals('Blackbird Chess Unit Test Tournament', $this->testobject->Tournament->Name);
|
|
}
|
|
|
|
public function testReadTournamentOrganiser(): void
|
|
{
|
|
$this->assertEquals('Blackbird Chess Developers', $this->testobject->Tournament->Organiser);
|
|
}
|
|
|
|
public function testReadTournamentLocation(): void
|
|
{
|
|
$this->assertEquals('Waregem', $this->testobject->Tournament->OrganiserPlace);
|
|
}
|
|
|
|
public function testHas8Players(): void
|
|
{
|
|
$this->assertCount(8, $this->testobject->Tournament->Players);
|
|
}
|
|
|
|
public function testHas7Rounds(): void
|
|
{
|
|
$this->assertCount(7, $this->testobject->Tournament->Rounds);
|
|
}
|
|
|
|
public function testPlayerHas7Pairings(): void
|
|
{
|
|
$this->assertCount(7, $this->testobject->Tournament->Players[0]->Pairings);
|
|
}
|
|
|
|
public function testPlayerHasTitle(): void
|
|
{
|
|
$player1 = Player::PlayersByName('Player 1', $this->testobject->Tournament)[0];
|
|
$this->assertInstanceOf(Title::class, $player1->Title);
|
|
}
|
|
}
|