Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

EntriesTest.php 1.76 KB
Newer Older
Olivier Lequeux's avatar
Olivier Lequeux committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
<?php

require_once dirname(__FILE__) . '/../../Lavoisier/IEntries.php';
require_once dirname(__FILE__) . '/../Entries.php';
require_once dirname(__FILE__) . '/../IHydrator.php';
require_once dirname(__FILE__) . '/../Hydrators/EntriesHydrator.php';

require_once dirname(__FILE__) . '/../../TicketingSystem/Ticket/ArrayFields.php';
require_once dirname(__FILE__) . '/../../TicketingSystem/Ticket/GgusFields.php';


use \Lavoisier\Entries;


class EntriesTest extends \PHPUnit_Framework_TestCase
{


    public function testasXmlEntries()
    {
        $input = array(
            array(
                "HOSTNAME" => "cream1.farm.particle.cz",
                "GOCDB_PORTAL_URL" => "https://goc.egi.eu/portal/index.php?Page_Type=Service&amp;id=751",
                "SERVICE_TYPE" => "APEL",
                "IN_PRODUCTION" => "Y",
                "NODE_MONITORED" => "Y"
            ),
            array(
                "HOSTNAME" => "cream1.farm.particle.cz",
                "GOCDB_PORTAL_URL" => "https://goc.egi.eu/portal/index.php?Page_Type=Service&amp;id=751",
                "SERVICE_TYPE" => "APEL",
                "IN_PRODUCTION" => "Y",
                "NODE_MONITORED" => "Y"
            )
        );
        $output_expected = file_get_contents(dirname(__FILE__) . '/Resources/entries_test.xml');
        $lh = new Entries($input);
        $ouput_obtained = $lh->asXmlEntries();
        $this->assertXmlStringEqualsXmlString($output_expected, $ouput_obtained);


    }


    public function testTicketHydratation()
    {

        $input = file_get_contents(dirname(__FILE__) . '/Resources/tickets.xml');
        $hydrator = new \Lavoisier\Hydrators\EntriesHydrator("\TicketingSystem\Ticket\GgusFields");
        $coll = $hydrator->hydrate($input);

        print_r($coll);

    }

}