Compare commits

..

1 Commits

Author SHA1 Message Date
bef365665e
Added tests with titles 2023-01-14 16:08:44 +01:00
4 changed files with 6 additions and 42 deletions

Binary file not shown.

Binary file not shown.

View File

@ -3,8 +3,6 @@
namespace Blackbirdchess\Tests\Service\Import\Readers;
use Blackbirdchess\Service\Import\Readers\Pairtwo6;
use Blackbirdchess\Service\Results\Enums\Title;
use Blackbirdchess\Service\Results\Player;
use PHPUnit\Framework\TestCase;
class Pairtwo6Test extends TestCase
@ -14,15 +12,7 @@ class Pairtwo6Test extends TestCase
public function setUp(): void
{
$root = NULL;
$directory = dirname(__FILE__);
do {
$directory = dirname($directory);
$composer = $directory . '/composer.json';
if(file_exists($composer)) $root = $directory;
} while(is_null($root) && $directory != '/');
$this->testfile = $root . $this->testfile;
$this->testfile = getcwd() . $this->testfile;
$this->testobject = new Pairtwo6();
$this->testobject->read($this->testfile);
}
@ -56,16 +46,4 @@ class Pairtwo6Test extends TestCase
{
$this->assertCount(7, $this->testobject->Tournament->Players[0]->Pairings);
}
public function testPlayerHasTitle(): void
{
$player = Player::PlayersByName('Player 1', $this->testobject->Tournament)[0];
$this->assertInstanceOf(Title::class, $player->Title);
}
public function testPlayerHasNoTitle(): void
{
$player = Player::PlayersByName('Player 3', $this->testobject->Tournament)[0];
$this->assertNull($player->Title);
}
}

View File

@ -9,22 +9,14 @@ use PHPUnit\Framework\TestCase;
class Swar5Test extends TestCase
{
private string $testfile = '/res/Swar5-testfile.swar';
private string $swarfile = '/res/Swar5-testfile.swar';
private Swar5 $testobject;
public function setUp(): void
{
$root = NULL;
$directory = dirname(__FILE__);
do {
$directory = dirname($directory);
$composer = $directory . '/composer.json';
if(file_exists($composer)) $root = $directory;
} while(is_null($root) && $directory != '/');
$this->testfile = $directory . $this->testfile;
$this->swarfile = getcwd() . $this->swarfile;
$this->testobject = new Swar5();
$this->testobject->read($this->testfile);
$this->testobject->read($this->swarfile);
}
public function testReadTournamentName(): void
@ -59,13 +51,7 @@ class Swar5Test extends TestCase
public function testPlayerHasTitle(): void
{
$player = Player::PlayersByName('Player 1', $this->testobject->Tournament)[0];
$this->assertInstanceOf(Title::class, $player->Title);
}
public function testPlayerHasNoTitle(): void
{
$player = Player::PlayersByName('Player 3', $this->testobject->Tournament)[0];
$this->assertNull($player->Title);
$player1 = Player::PlayersByName('Player 1', $this->testobject->Tournament)[0];
$this->assertInstanceOf(Title::class, $player1->Title);
}
}