samedi 11 juillet 2015

Test assertions in PHPUnit for XML elements on a page?

I want to assert that the element within an XML element on a page in PHP is asserted as equal.

What's the best way to do two tests. One on the first ip and one on the second ip tag?

Dipping my toes in the water snippet:

public function testPPTPRangeChecker(){

echo "Loggin in as the adinistrator";
//Login as the administrator
$client = $this->myLoginAs('adminuser','Testing1!');

echo "The test user has successfully logged in as administrator";
$crawler = $client->request('POST', '/config/19/46');
echo "The site has navigated successfully to the config page";

    $this->assertTag(
        array(
            'tag' => 'ip',
            'content' => '192.168.1.1'
            )
        );

XML

<pptpd>
        <user>
            <name>testuser</name>
            <ip>192.168.1.1</ip>
            <password>testpass</password>
        </user>
        <user>
            <name>testuser2</name>
            <ip>192.168.1.2</ip>
            <password>testpass2</password>
        </user>

    </pptpd>

Aucun commentaire:

Enregistrer un commentaire