Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into ValidatorMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
Matej Szendi committed Nov 4, 2013
153 parents 4a236d9 + d33ea7d + dd7c7b1 + e4fdd4c + 4ea852c + 6e89cc1 + 46b4569 + b0e12bf + 40d2cad + dcdecad + 978a0d2 + f68efae + 24315d0 + 90bab68 + d5240ce + a4cf61f + 737988b + 24b691f + b2ba0b2 + 3df4d2a + d37df59 + 7f0c1ad + 25ddb64 + 61dafd7 + 6eb1418 + 72e4c73 + 484fecb + 17ed9ab + 9881dbb + 6d7f5ab + 561ef2b + 567588e + 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 + ef273f8 + 6c44bc5 + ddae1cc + fc0f217 + 05d994b + 386083b + 7890c16 + 07c51ae + a62d81b + 53960c5 + 3521702 + e2fdffd + 160ad66 + 10bff24 + 944d975 + 71f09ad + 03fbbc3 + 5d527bf + 4281c0c + cc36360 + b1dde09 + e21037b + 08b1d98 + e693e44 + 0bd83de + 5dce05d + 3641177 + 226d56e + 6b82dec + 30e3679 + d702695 + e95ddeb + 6f8f3b1 + 9a73c30 + ef8261e + d9444bc + 1c0773a + e1a1f7a + 7781996 + 1524272 + 7cec1e0 + cf88eec + c11f566 + 0351056 + b5d005e + afdf14f + 94358ed + 6102afa + 1e99572 + 31681fd + 313e55d + 201b9ed + 27ee3a0 + cdbfa8a + ffed7ac + 0649e63 + dea5f03 + 73dcc77 + 5cce900 + 06d6397 + aaeffe0 + fab0f36 + 549fb43 + 299aee9 + 6cf210f + 4cfed7b commit f7d2a49
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 54 deletions.
5 changes: 4 additions & 1 deletion src/AbstractValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* function acts likes a factory for the Zend\XmlRpc\Value objects
*
* Using this function, users/Zend\XmlRpc\Client object can create the Zend\XmlRpc\Value objects
* from PHP variables, XML string or by specifying the exact XML-RPC natvie type
* from PHP variables, XML string or by specifying the exact XML-RPC native type
*/
abstract class AbstractValue
{
Expand Down Expand Up @@ -445,6 +445,9 @@ protected static function _extractTypeAndValue(\SimpleXMLElement $xml, &$type, &
// If no type was specified, the default is string
if (!$type) {
$type = self::XMLRPC_TYPE_STRING;
if (empty($value) and preg_match('#^<value>.*</value>$#', $xml->asXML())) {
$value = str_replace(array('<value>', '</value>'), '', $xml->asXML());
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Request/Stdin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace Zend\XmlRpc\Request;

use Zend\XmlRpc\Request as XmlRpcRequest;
use Zend\XmlRpc\Server\Exception as ServerException;
use Zend\XmlRpc\Fault;

/**
* XmlRpc Request object -- Request via STDIN
Expand Down Expand Up @@ -39,7 +39,7 @@ public function __construct()
{
$fh = fopen('php://stdin', 'r');
if (!$fh) {
$this->fault = new ServerException(630);
$this->fault = new Fault(630);
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Value/AbstractCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class AbstractCollection extends AbstractValue
*/
public function __construct($value)
{
$values = (array)$value; // Make sure that the value is an array
$values = (array) $value; // Make sure that the value is an array
foreach ($values as $key => $value) {
// If the elements of the given array are not Zend\XmlRpc\Value objects,
// we need to convert them as such (using auto-detection from PHP value)
Expand All @@ -40,7 +40,7 @@ public function __construct($value)
*/
public function getValue()
{
$values = (array)$this->value;
$values = (array) $this->value;
foreach ($values as $key => $value) {
$values[$key] = $value->getValue();
}
Expand Down
4 changes: 0 additions & 4 deletions test/BigIntegerValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc;
Expand All @@ -16,9 +15,6 @@
use Zend\XmlRpc\Generator\GeneratorInterface as Generator;

/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage UnitTests
* @group Zend_XmlRpc
*/
class BigIntegerValueTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc;
Expand All @@ -19,9 +18,6 @@
use Zend\XmlRpc;

/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage UnitTests
* @group Zend_XmlRpc
*/
class ClientTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/FaultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc;
Expand All @@ -14,9 +13,6 @@
use Zend\XmlRpc;

/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage UnitTests
* @group Zend_XmlRpc
*/
class FaultTest extends \PHPUnit_Framework_TestCase
Expand Down
6 changes: 1 addition & 5 deletions test/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc;

use Zend\XmlRpc\Generator\GeneratorInterface as Generator;

/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage UnitTests
* @group Zend_XmlRpc
*/
class GeneratorTest extends \PHPUnit_Framework_TestCase
Expand Down Expand Up @@ -65,7 +61,7 @@ public function testFlushingGeneratorFlushesEverything(Generator $generator)
$generator->openElement('test')->closeElement('test');
$this->assertXml('<test/>', $generator);
$this->assertContains('<test/>', $generator->flush());
$this->assertSame('', (string)$generator);
$this->assertSame('', (string) $generator);
}

/**
Expand Down
4 changes: 0 additions & 4 deletions test/Request/HttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc\Request;
Expand All @@ -14,9 +13,6 @@
use ZendTest\AllTests\StreamWrapper\PHPInput;

/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage UnitTests
* @group Zend_XmlRpc
*/
class HTTPTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc;
Expand All @@ -15,9 +14,6 @@
use Zend\XmlRpc\Value;

/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage UnitTests
* @group Zend_XmlRpc
*/
class RequestTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc;
Expand All @@ -14,9 +13,6 @@
use Zend\XmlRpc\AbstractValue;

/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage UnitTests
* @group Zend_XmlRpc
*/
class ResponseTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/Server/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc\Server;

use Zend\XmlRpc\Server;

/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage UnitTests
* @group Zend_XmlRpc
*/
class CacheTest extends \PHPUnit_Framework_TestCase
Expand Down
10 changes: 3 additions & 7 deletions test/Server/FaultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc\Server;

use Zend\XmlRpc\Server;

/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage UnitTests
* @group Zend_XmlRpc
*/
class FaultTest extends \PHPUnit_Framework_TestCase
Expand Down Expand Up @@ -229,11 +225,11 @@ private function __construct()

public static function getInstance()
{
if (!self::$_instance) {
self::$_instance = new self();
if (!static::$_instance) {
static::$_instance = new self();
}

return self::$_instance;
return static::$_instance;
}

public static function observe(Server\Fault $fault)
Expand Down
4 changes: 0 additions & 4 deletions test/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc;
Expand All @@ -19,9 +18,6 @@
use Zend\XmlRpc;

/**
* @category Zend
* @package Zend_XmlRpc
* @subpackage UnitTests
* @group Zend_XmlRpc
*/
class ServerTest extends \PHPUnit_Framework_TestCase
Expand Down
1 change: 0 additions & 1 deletion test/TestProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc;
Expand Down
19 changes: 15 additions & 4 deletions test/ValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_XmlRpc
*/

namespace ZendTest\XmlRpc;
Expand All @@ -19,9 +18,6 @@
/**
* Test case for Value
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage UnitTests
* @group Zend_XmlRpc
*/
class ValueTest extends \PHPUnit_Framework_TestCase
Expand Down Expand Up @@ -214,6 +210,21 @@ public function testMarshalStringFromNative()
$this->assertSame($native, $val->getValue());
}

public function testFactoryAutodetectsStringAndSetsValueInArray()
{
$val = AbstractValue::getXmlRpcValue('<value><array><data>'.
'<value><i4>8</i4></value>'.
'<value>a</value>'.
'<value>false</value>'.
'</data></array></value>', AbstractValue::XML_STRING
);
$this->assertXmlRpcType('array', $val);
$a = $val->getValue();
$this->assertSame(8, $a[0]);
$this->assertSame('a', $a[1]);
$this->assertSame('false', $a[2]);
}

/**
* @dataProvider ZendTest\XmlRpc\TestProvider::provideGenerators
*/
Expand Down

0 comments on commit f7d2a49

Please sign in to comment.