function setUp() { XmlSerializer::$sort = false; }
function setUp() { $this->serializer = new XmlSerializer(new XmlMapping()); XmlSerializer::$sort = false; }
function test_toXmlRecursiveSorted() { $a = new Address($this->fixture('address.json')); $a->foo = new MpiParams(array('x' => '1', 'a' => '2', 'k' => '3')); XmlSerializer::$sort = true; $root = XmlSerializer::createDocument('r'); XmlSerializer::_toXml($a, $root); $str = $root->ownerDocument->saveXML(); $this->assertEqual($str, '<?xml version="1.0" encoding="UTF-8"?> <r> <address1>Kurfürstendamm 123</address1> <city>Berlin</city> <country>DE</country> <first_name>Hans</first_name> <foo> <a>2</a> <k>3</k> <x>1</x> </foo> <last_name>Johanson</last_name> <zip_code>10624</zip_code> </r> '); }
function testGetTransaction() { XmlSerializer::$sort = false; // prepare post, request, response fixtures $postData = $this->schemaNotification('transaction_notification.json'); $channel_token = $postData['channel_token']; $uid = $postData['unique_id']; $requestXml = $this->schemaRequest('reconcile.xml'); $requestXml = preg_replace('/<unique_id>[^<]+<\\/unique_id>/', "<unique_id>{$uid}</unique_id>", $requestXml); $responseXml = $this->schemaResponse('reconcile.xml'); $responseXml = preg_replace('/<unique_id>[^<]+<\\/unique_id>/', "<unique_id>{$uid}</unique_id>", $responseXml); $this->curlMock()->shouldReceive('xmlPost')->with("https://test.hypercharge.net/reconcile/{$channel_token}", $requestXml)->once()->andReturn($responseXml); // actually test the notification $tn = new TransactionNotification($postData); $this->assertTrue($tn->hasTransaction()); $trx = $tn->getTransaction(); $this->assertIsA($trx, 'Hypercharge\\Transaction'); $this->assertTrue($trx->isApproved()); $this->assertEqual($trx->unique_id, $uid); }