Moved tests and updated to use namespaces

This commit is contained in:
Josh Sherman 2014-09-28 07:31:02 -04:00
parent 302f400dcb
commit 0cfc2c7979
26 changed files with 686 additions and 683 deletions

27
tests/ConvertTest.php Normal file
View file

@ -0,0 +1,27 @@
<?php
class ConvertTest extends PHPUnit_Framework_TestCase
{
/**
* @dataProvider providerArrayToXML
*/
public function testArrayToXML($a, $b, $c)
{
$this->assertEquals(Pickles\Convert::arrayToXML($a, $b), $c);
}
public function providerArrayToXML()
{
return [
['foo', false, ''],
[['foo', 'bar'], false, '<0>foo</0><1>bar</1>'],
[['foo', 'bar'], true, "<0>foo</0>\n<1>bar</1>\n"],
[['foo' => 'bar'], false, '<foo>bar</foo>'],
[['foo' => 'b & r'], false, '<foo><![CDATA[b & r]]></foo>'],
[['children' => ['child' => ['foo', 'bar']]], false, '<children><child>foo</child><child>bar</child></children>'],
[['children' => ['child' => ['foo & bar']]], false, '<children><child><![CDATA[foo & bar]]></child></children>'],
[['children' => ['child' => ['foo', 'bar']]], true, "<children>\n\t<child>foo</child>\n\t<child>bar</child>\n</children>\n"],
];
}
}