diff --git a/res/Blackbird Chess Unit Test Tournament.ods b/res/Blackbird Chess Unit Test Tournament.ods index 54a7b3e..d305e41 100644 Binary files a/res/Blackbird Chess Unit Test Tournament.ods and b/res/Blackbird Chess Unit Test Tournament.ods differ diff --git a/res/Swar5-testfile.swar b/res/Swar5-testfile.swar index d002608..adb2962 100644 Binary files a/res/Swar5-testfile.swar and b/res/Swar5-testfile.swar differ diff --git a/src/Readers/Pairtwo6.php b/src/Readers/Pairtwo6.php index 319243e..58499be 100644 --- a/src/Readers/Pairtwo6.php +++ b/src/Readers/Pairtwo6.php @@ -494,7 +494,7 @@ class Pairtwo6 implements ReaderInterface break; case 0: default: - $title = Title::NONE; + $title = NULL; break; } $player->Title = $title; diff --git a/src/Readers/Swar4.php b/src/Readers/Swar4.php index 6c10462..11c4728 100644 --- a/src/Readers/Swar4.php +++ b/src/Readers/Swar4.php @@ -164,7 +164,7 @@ class Swar4 implements ReaderInterface case TournamentSystem::CLOSED: case TournamentSystem::SWISS: default: - $firstElement = new Tiebreak(Tiebreak::POINTS); + $firstElement = Tiebreak::POINTS; } $tiebreaks = $this->Tournament->Tiebreaks; array_unshift($tiebreaks, $firstElement); @@ -382,7 +382,7 @@ class Swar4 implements ReaderInterface $tiebreak = Tiebreak::BLACK_WIN; break; } - $tiebreaks[] = new Tiebreak($tiebreak); + $tiebreaks[] = $tiebreak; } $this->Tournament->Tiebreaks = $tiebreaks; @@ -439,7 +439,7 @@ class Swar4 implements ReaderInterface $gender = Gender::NEUTRAL; break; } - $player->Gender = new Gender($gender); + $player->Gender = $gender; $player->Nation = $this->readData('String', $swshandle); $player->setId('Nation', $this->readData('Int', $swshandle)); @@ -480,10 +480,10 @@ class Swar4 implements ReaderInterface break; case 0: default: - $title = Title::NONE; + $title = NULL; break; } - $player->Title = new Title($title); + $player->Title = $title; $player->setId('Club', $this->readData('Int', $swshandle)); $player->ClubName = $this->readData('String', $swshandle); @@ -562,7 +562,7 @@ class Swar4 implements ReaderInterface if (array_search($this->Tournament->Pairing[ $ptn ][ 'table' ], [16383, 8191]) !== false) { $result = Result::ABSENT; } - $pairing->Result = new Result($result); + $pairing->Result = $result; switch ($this->Tournament->Pairing[ $ptn ][ 'color' ]) { case 4294967295: @@ -576,7 +576,7 @@ class Swar4 implements ReaderInterface $color = Color::NONE; break; } - $pairing->Color = new Color($color); + $pairing->Color = $color; $pairing->Board = $this->Tournament->Pairing[ $ptn ][ 'table' ]; $ptn++; diff --git a/src/Readers/Swar5.php b/src/Readers/Swar5.php index d0876eb..5ce5d70 100644 --- a/src/Readers/Swar5.php +++ b/src/Readers/Swar5.php @@ -500,7 +500,7 @@ class Swar5 implements ReaderInterface break; case 0: default: - $title = Title::NONE; + $title = NULL; break; } $player->Title = $title; diff --git a/tests/Readers/Pairtwo6Test.php b/tests/Readers/Pairtwo6Test.php index cb21789..0c0bdce 100644 --- a/tests/Readers/Pairtwo6Test.php +++ b/tests/Readers/Pairtwo6Test.php @@ -41,4 +41,9 @@ class Pairtwo6Test extends TestCase { $this->assertCount(7, $this->testobject->Tournament->Rounds); } + + public function testPlayerHas7Pairings(): void + { + $this->assertCount(7, $this->testobject->Tournament->Players[0]->Pairings); + } } diff --git a/tests/Readers/Swar5Test.php b/tests/Readers/Swar5Test.php index 080827a..0dfd7c5 100644 --- a/tests/Readers/Swar5Test.php +++ b/tests/Readers/Swar5Test.php @@ -3,6 +3,8 @@ 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 @@ -41,4 +43,15 @@ class Swar5Test extends TestCase { $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); + } }