This repository has been archived by the owner on Apr 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/xmlrpc' of https://github.com/sasezaki/zf2
- Loading branch information
56 parents
ec0d061
+
3a9c051
+
ffadf7b
+
8c8ab46
+
56dffee
+
9b3291e
+
72011a1
+
79d20ae
+
0023b68
+
203219a
+
51f1e65
+
adba36a
+
48704a6
+
3ed141c
+
a79cdbd
+
73871a0
+
47d468d
+
538d0f4
+
b5ad75a
+
2363c4f
+
91c2337
+
04dcb58
+
906c7b6
+
0da7bb6
+
0270a77
+
6784c86
+
90d950a
+
3b5ea7f
+
339830e
+
b04f4d5
+
8da9d32
+
0e2a882
+
f0829e4
+
c66d3bb
+
c44c042
+
e2121f5
+
19560b1
+
f08a210
+
294332a
+
3ab34f5
+
bb64c7d
+
b204532
+
1e8aff5
+
da2423f
+
7fce745
+
6c8026c
+
a449c92
+
c9f86d3
+
b2b0ea1
+
3b554ac
+
4deeef8
+
c6f5d24
+
fdaf0f2
+
6047973
+
66f79d5
+
596197a
commit 567588e
Showing
3 changed files
with
158 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_XmlRpc | ||
* @subpackage UnitTests | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace ZendTest\XmlRpc; | ||
use Zend\XmlRpc\Value; | ||
use Zend\XmlRpc\Value\BigInteger; | ||
use Zend\XmlRpc\Exception; | ||
use Zend\XmlRpc\Generator\GeneratorInterface as Generator; | ||
use Zend\Math\BigInteger as MathBigInteger; | ||
use Zend\Date; | ||
|
||
/** | ||
* Test case for Zend_XmlRpc_Value | ||
* | ||
* @category Zend | ||
* @package Zend_XmlRpc | ||
* @subpackage UnitTests | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @group Zend_XmlRpc | ||
*/ | ||
class BigIntegerValueTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
try { | ||
$XmlRpcBigInteger = new BigInteger(0); | ||
} catch (\Zend\Math\Exception $e) { | ||
$this->markTestSkipped($e->getMessage()); | ||
} | ||
} | ||
|
||
// BigInteger | ||
|
||
/** | ||
* @group ZF-6445 | ||
* @group ZF-8623 | ||
*/ | ||
public function testBigIntegerGetValue() | ||
{ | ||
$bigIntegerValue = (string)(PHP_INT_MAX + 42); | ||
$bigInteger = new BigInteger($bigIntegerValue); | ||
$this->assertSame($bigIntegerValue, $bigInteger->getValue()); | ||
} | ||
|
||
/** | ||
* @group ZF-6445 | ||
*/ | ||
public function testBigIntegerGetType() | ||
{ | ||
$bigIntegerValue = (string)(PHP_INT_MAX + 42); | ||
$bigInteger = new BigInteger($bigIntegerValue); | ||
$this->assertSame(Value::XMLRPC_TYPE_I8, $bigInteger->getType()); | ||
} | ||
|
||
/** | ||
* @group ZF-6445 | ||
*/ | ||
public function testBigIntegerGeneratedXml() | ||
{ | ||
$bigIntegerValue = (string)(PHP_INT_MAX + 42); | ||
$bigInteger = new BigInteger($bigIntegerValue); | ||
|
||
$this->assertEquals( | ||
'<value><i8>' . $bigIntegerValue . '</i8></value>', | ||
$bigInteger->saveXml() | ||
); | ||
} | ||
|
||
/** | ||
* @group ZF-6445 | ||
* @dataProvider \ZendTest\XmlRpc\TestProvider::provideGenerators | ||
*/ | ||
public function testMarschalBigIntegerFromXmlRpc(Generator $generator) | ||
{ | ||
Value::setGenerator($generator); | ||
|
||
$bigIntegerValue = (string)(PHP_INT_MAX + 42); | ||
$bigInteger = new BigInteger($bigIntegerValue); | ||
$bigIntegerXml = '<value><i8>' . $bigIntegerValue . '</i8></value>'; | ||
|
||
$value = Value::getXmlRpcValue( | ||
$bigIntegerXml, | ||
Value::XML_STRING | ||
); | ||
|
||
$this->assertSame($bigIntegerValue, $value->getValue()); | ||
$this->assertEquals(Value::XMLRPC_TYPE_I8, $value->getType()); | ||
$this->assertEquals($this->wrapXml($bigIntegerXml), $value->saveXml()); | ||
} | ||
|
||
/** | ||
* @group ZF-6445 | ||
* @dataProvider \ZendTest\XmlRpc\TestProvider::provideGenerators | ||
*/ | ||
public function testMarschalBigIntegerFromApacheXmlRpc(Generator $generator) | ||
{ | ||
Value::setGenerator($generator); | ||
|
||
$bigIntegerValue = (string)(PHP_INT_MAX + 42); | ||
$bigInteger = new BigInteger($bigIntegerValue); | ||
$bigIntegerXml = '<value><ex:i8 xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">' . $bigIntegerValue . '</ex:i8></value>'; | ||
|
||
$value = Value::getXmlRpcValue( | ||
$bigIntegerXml, | ||
Value::XML_STRING | ||
); | ||
|
||
$this->assertSame($bigIntegerValue, $value->getValue()); | ||
$this->assertEquals(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 = Value::getXmlRpcValue( | ||
$bigIntegerValue, | ||
Value::XMLRPC_TYPE_I8 | ||
); | ||
|
||
$this->assertEquals(Value::XMLRPC_TYPE_I8, $value->getType()); | ||
$this->assertSame($bigIntegerValue, $value->getValue()); | ||
} | ||
|
||
// Custom Assertions and Helper Methods | ||
|
||
public function wrapXml($xml) | ||
{ | ||
return $xml . "\n"; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters