Added tests with titles
This commit is contained in:
parent
3532386aef
commit
bef365665e
Binary file not shown.
Binary file not shown.
@ -494,7 +494,7 @@ class Pairtwo6 implements ReaderInterface
|
|||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
$title = Title::NONE;
|
$title = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$player->Title = $title;
|
$player->Title = $title;
|
||||||
|
@ -164,7 +164,7 @@ class Swar4 implements ReaderInterface
|
|||||||
case TournamentSystem::CLOSED:
|
case TournamentSystem::CLOSED:
|
||||||
case TournamentSystem::SWISS:
|
case TournamentSystem::SWISS:
|
||||||
default:
|
default:
|
||||||
$firstElement = new Tiebreak(Tiebreak::POINTS);
|
$firstElement = Tiebreak::POINTS;
|
||||||
}
|
}
|
||||||
$tiebreaks = $this->Tournament->Tiebreaks;
|
$tiebreaks = $this->Tournament->Tiebreaks;
|
||||||
array_unshift($tiebreaks, $firstElement);
|
array_unshift($tiebreaks, $firstElement);
|
||||||
@ -382,7 +382,7 @@ class Swar4 implements ReaderInterface
|
|||||||
$tiebreak = Tiebreak::BLACK_WIN;
|
$tiebreak = Tiebreak::BLACK_WIN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$tiebreaks[] = new Tiebreak($tiebreak);
|
$tiebreaks[] = $tiebreak;
|
||||||
}
|
}
|
||||||
$this->Tournament->Tiebreaks = $tiebreaks;
|
$this->Tournament->Tiebreaks = $tiebreaks;
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ class Swar4 implements ReaderInterface
|
|||||||
$gender = Gender::NEUTRAL;
|
$gender = Gender::NEUTRAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$player->Gender = new Gender($gender);
|
$player->Gender = $gender;
|
||||||
|
|
||||||
$player->Nation = $this->readData('String', $swshandle);
|
$player->Nation = $this->readData('String', $swshandle);
|
||||||
$player->setId('Nation', $this->readData('Int', $swshandle));
|
$player->setId('Nation', $this->readData('Int', $swshandle));
|
||||||
@ -480,10 +480,10 @@ class Swar4 implements ReaderInterface
|
|||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
$title = Title::NONE;
|
$title = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$player->Title = new Title($title);
|
$player->Title = $title;
|
||||||
|
|
||||||
$player->setId('Club', $this->readData('Int', $swshandle));
|
$player->setId('Club', $this->readData('Int', $swshandle));
|
||||||
$player->ClubName = $this->readData('String', $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) {
|
if (array_search($this->Tournament->Pairing[ $ptn ][ 'table' ], [16383, 8191]) !== false) {
|
||||||
$result = Result::ABSENT;
|
$result = Result::ABSENT;
|
||||||
}
|
}
|
||||||
$pairing->Result = new Result($result);
|
$pairing->Result = $result;
|
||||||
|
|
||||||
switch ($this->Tournament->Pairing[ $ptn ][ 'color' ]) {
|
switch ($this->Tournament->Pairing[ $ptn ][ 'color' ]) {
|
||||||
case 4294967295:
|
case 4294967295:
|
||||||
@ -576,7 +576,7 @@ class Swar4 implements ReaderInterface
|
|||||||
$color = Color::NONE;
|
$color = Color::NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$pairing->Color = new Color($color);
|
$pairing->Color = $color;
|
||||||
|
|
||||||
$pairing->Board = $this->Tournament->Pairing[ $ptn ][ 'table' ];
|
$pairing->Board = $this->Tournament->Pairing[ $ptn ][ 'table' ];
|
||||||
$ptn++;
|
$ptn++;
|
||||||
|
@ -500,7 +500,7 @@ class Swar5 implements ReaderInterface
|
|||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
$title = Title::NONE;
|
$title = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$player->Title = $title;
|
$player->Title = $title;
|
||||||
|
@ -41,4 +41,9 @@ class Pairtwo6Test extends TestCase
|
|||||||
{
|
{
|
||||||
$this->assertCount(7, $this->testobject->Tournament->Rounds);
|
$this->assertCount(7, $this->testobject->Tournament->Rounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testPlayerHas7Pairings(): void
|
||||||
|
{
|
||||||
|
$this->assertCount(7, $this->testobject->Tournament->Players[0]->Pairings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
namespace Blackbirdchess\Tests\Service\Import\Readers;
|
namespace Blackbirdchess\Tests\Service\Import\Readers;
|
||||||
|
|
||||||
use Blackbirdchess\Service\Import\Readers\Swar5;
|
use Blackbirdchess\Service\Import\Readers\Swar5;
|
||||||
|
use Blackbirdchess\Service\Results\Enums\Title;
|
||||||
|
use Blackbirdchess\Service\Results\Player;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class Swar5Test extends TestCase
|
class Swar5Test extends TestCase
|
||||||
@ -41,4 +43,15 @@ class Swar5Test extends TestCase
|
|||||||
{
|
{
|
||||||
$this->assertCount(7, $this->testobject->Tournament->Rounds);
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user