wip: initial commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\BusProNet\DataLoader;
|
||||
|
||||
use App\BusProNet\DataLoader\TravelDataLoader;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TravelDataLoaderTest extends TestCase
|
||||
{
|
||||
public function testParse(): void
|
||||
{
|
||||
$loader = new TravelDataLoader('');
|
||||
$filename = __DIR__.'/../../Resources/travel_data.xml';
|
||||
$travelId = 11478;
|
||||
|
||||
$xml = $loader->loadById($travelId, $filename);
|
||||
$this->assertInstanceOf(\SimpleXMLElement::class, $xml);
|
||||
|
||||
$travel = $loader->parseXml($xml);
|
||||
|
||||
$this->assertInstanceOf(Travel::class, $travel);
|
||||
$this->assertEquals('DPWMP060125', $travel->code);
|
||||
$this->assertEquals('F', $travel->type);
|
||||
$this->assertInstanceOf(\DateTimeImmutable::class, $travel->dateFrom);
|
||||
$this->assertInstanceOf(\DateTimeImmutable::class, $travel->dateTo);
|
||||
$this->assertEquals('Davos - Sportclub Waldschlössli', $travel->label);
|
||||
$this->assertEquals(534.2, $travel->priceFrom);
|
||||
|
||||
$this->assertCount(8, $travel->selectionGroups);
|
||||
$this->assertCount(27, $travel->additionalServices);
|
||||
$this->assertCount(5, $travel->transportationServices);
|
||||
$this->assertCount(7, $travel->pickups);
|
||||
$this->assertCount(12, $travel->rooms);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user