markTestSkipped($e->getMessage());
}
}
// BigInteger
/**
* @group ZF-6445
* @group ZF-8623
*/
public function testBigIntegerGetValue()
{
$bigIntegerValue = (string)(PHP_INT_MAX + 42);
$bigInteger = new Zend_XmlRpc_Value_BigInteger($bigIntegerValue);
$this->assertSame($bigIntegerValue, $bigInteger->getValue());
}
/**
* @group ZF-6445
*/
public function testBigIntegerGetType()
{
$bigIntegerValue = (string)(PHP_INT_MAX + 42);
$bigInteger = new Zend_XmlRpc_Value_BigInteger($bigIntegerValue);
$this->assertSame(Zend_XmlRpc_Value::XMLRPC_TYPE_I8, $bigInteger->getType());
}
/**
* @group ZF-6445
*/
public function testBigIntegerGeneratedXml()
{
$bigIntegerValue = (string)(PHP_INT_MAX + 42);
$bigInteger = new Zend_XmlRpc_Value_BigInteger($bigIntegerValue);
$this->assertEquals(
'' . $bigIntegerValue . '',
$bigInteger->saveXml()
);
}
/**
* @group ZF-6445
* @dataProvider Zend_XmlRpc_TestProvider::provideGenerators
*/
public function testMarschalBigIntegerFromXmlRpc(Zend_XmlRpc_Generator_GeneratorAbstract $generator)
{
Zend_XmlRpc_Value::setGenerator($generator);
$bigIntegerValue = (string)(PHP_INT_MAX + 42);
$bigInteger = new Zend_XmlRpc_Value_BigInteger($bigIntegerValue);
$bigIntegerXml = '' . $bigIntegerValue . '';
$value = Zend_XmlRpc_Value::getXmlRpcValue(
$bigIntegerXml,
Zend_XmlRpc_Value::XML_STRING
);
$this->assertSame($bigIntegerValue, $value->getValue());
$this->assertEquals(Zend_XmlRpc_Value::XMLRPC_TYPE_I8, $value->getType());
$this->assertEquals($this->wrapXml($bigIntegerXml), $value->saveXml());
}
/**
* @group ZF-6445
* @dataProvider Zend_XmlRpc_TestProvider::provideGenerators
*/
public function testMarschalBigIntegerFromApacheXmlRpc(Zend_XmlRpc_Generator_GeneratorAbstract $generator)
{
Zend_XmlRpc_Value::setGenerator($generator);
$bigIntegerValue = (string)(PHP_INT_MAX + 42);
$bigInteger = new Zend_XmlRpc_Value_BigInteger($bigIntegerValue);
$bigIntegerXml = '' . $bigIntegerValue . '';
$value = Zend_XmlRpc_Value::getXmlRpcValue(
$bigIntegerXml,
Zend_XmlRpc_Value::XML_STRING
);
$this->assertSame($bigIntegerValue, $value->getValue());
$this->assertEquals(Zend_XmlRpc_Value::XMLRPC_TYPE_I8, $value->getType());
$this->assertEquals($this->wrapXml($bigIntegerXml), $value->saveXml());
}
/**
* @group ZF-6445
*/
public function testMarshalBigIntegerFromNative()
{
$bigIntegerValue = (string)(PHP_INT_MAX + 42);
$value = Zend_XmlRpc_Value::getXmlRpcValue(
$bigIntegerValue,
Zend_XmlRpc_Value::XMLRPC_TYPE_I8
);
$this->assertEquals(Zend_XmlRpc_Value::XMLRPC_TYPE_I8, $value->getType());
$this->assertSame($bigIntegerValue, $value->getValue());
}
/**
* @group ZF-6445
*/
public function testMarschalBigIntegerFromCryptObjectThrowsException()
{
try {
Zend_XmlRpc_Value::getXmlRpcValue(new Zend_Crypt_Math_BigInteger);
$this->fail('expected Zend_XmlRpc_Value_Exception has not been thrown');
} catch (Zend_XmlRpc_Value_Exception $exception) {
if (strpos($exception->getMessage(), 'Zend_Crypt_Math_BigInteger') === false) {
$this->fail('caught Zend_XmlRpc_Value_Exception does not contain expected text');
}
}
}
// Custom Assertions and Helper Methods
public function wrapXml($xml)
{
return $xml . "\n";
}
}
// Call Zend_XmlRpc_ValueTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == "Zend_XmlRpc_BigIntegerValueTest::main") {
Zend_XmlRpc_ValueTest::main();
}