Issue #2287139 by alexpott: Fixed Various serialization test failures after updating to php 5.4.29.
parent
4086829bbe
commit
9601e39d34
|
@ -24,6 +24,7 @@
|
|||
"symfony-cmf/routing": "1.1.*@alpha",
|
||||
"easyrdf/easyrdf": "0.8.*",
|
||||
"phpunit/phpunit": "4.1.*",
|
||||
"phpunit/phpunit-mock-objects": "dev-master#e60bb929c50ae4237aaf680a4f6773f4ee17f0a2",
|
||||
"zendframework/zend-feed": "2.2.*"
|
||||
},
|
||||
"autoload": {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "cca4a51cbd3445ccdba4df24bdd2f49e",
|
||||
"hash": "d89a37ea785ca09523298ff00ade2eca",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
|
@ -970,16 +970,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
"version": "2.1.4",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
||||
"reference": "1a894a16b6c15fcdc5ef2b110f0e6233952c9b0f"
|
||||
"reference": "e60bb929c50ae4237aaf680a4f6773f4ee17f0a2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/1a894a16b6c15fcdc5ef2b110f0e6233952c9b0f",
|
||||
"reference": "1a894a16b6c15fcdc5ef2b110f0e6233952c9b0f",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/32f97c9198be565b6051983c70dc8d8e758725f4",
|
||||
"reference": "e60bb929c50ae4237aaf680a4f6773f4ee17f0a2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -987,7 +987,7 @@
|
|||
"phpunit/php-text-template": "~1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.1"
|
||||
"phpunit/phpunit": "4.3.*@dev"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-soap": "*"
|
||||
|
@ -995,7 +995,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
"dev-master": "2.3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -1023,7 +1023,7 @@
|
|||
"mock",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2014-06-07 16:22:57"
|
||||
"time": "2014-06-12 07:22:27"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
|
@ -2405,7 +2405,8 @@
|
|||
"doctrine/common": 20,
|
||||
"doctrine/annotations": 20,
|
||||
"kriswallsmith/assetic": 15,
|
||||
"symfony-cmf/routing": 15
|
||||
"symfony-cmf/routing": 15,
|
||||
"phpunit/phpunit-mock-objects": 20
|
||||
},
|
||||
"platform": {
|
||||
"php": ">=5.4.2"
|
||||
|
|
|
@ -87,7 +87,6 @@ return array(
|
|||
'PHPUnit_Framework_MockObject_Matcher' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher.php',
|
||||
'PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/AnyInvokedCount.php',
|
||||
'PHPUnit_Framework_MockObject_Matcher_AnyParameters' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/AnyParameters.php',
|
||||
'PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/ConsecutiveParameters.php',
|
||||
'PHPUnit_Framework_MockObject_Matcher_Invocation' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/Invocation.php',
|
||||
'PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/InvokedAtIndex.php',
|
||||
'PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/InvokedAtLeastOnce.php',
|
||||
|
|
|
@ -7,11 +7,11 @@ $baseDir = dirname(dirname($vendorDir));
|
|||
|
||||
return array(
|
||||
$vendorDir . '/phpunit/php-text-template',
|
||||
$vendorDir . '/phpunit/phpunit-mock-objects',
|
||||
$vendorDir . '/phpunit/php-timer',
|
||||
$vendorDir . '/phpunit/php-token-stream',
|
||||
$vendorDir . '/phpunit/php-file-iterator',
|
||||
$vendorDir . '/phpunit/php-code-coverage',
|
||||
$vendorDir . '/phpunit/phpunit',
|
||||
$vendorDir . '/symfony/yaml',
|
||||
$vendorDir . '/phpunit/phpunit-mock-objects',
|
||||
);
|
||||
|
|
|
@ -2124,65 +2124,6 @@
|
|||
"template"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
"version": "2.1.4",
|
||||
"version_normalized": "2.1.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
||||
"reference": "1a894a16b6c15fcdc5ef2b110f0e6233952c9b0f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/1a894a16b6c15fcdc5ef2b110f0e6233952c9b0f",
|
||||
"reference": "1a894a16b6c15fcdc5ef2b110f0e6233952c9b0f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"phpunit/php-text-template": "~1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-soap": "*"
|
||||
},
|
||||
"time": "2014-06-07 16:22:57",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"include-path": [
|
||||
""
|
||||
],
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Mock Object library for PHPUnit",
|
||||
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
|
||||
"keywords": [
|
||||
"mock",
|
||||
"xunit"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-timer",
|
||||
"version": "1.0.5",
|
||||
|
@ -2470,5 +2411,64 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
||||
"reference": "e60bb929c50ae4237aaf680a4f6773f4ee17f0a2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/32f97c9198be565b6051983c70dc8d8e758725f4",
|
||||
"reference": "e60bb929c50ae4237aaf680a4f6773f4ee17f0a2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"phpunit/php-text-template": "~1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.3.*@dev"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-soap": "*"
|
||||
},
|
||||
"time": "2014-06-12 07:22:27",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.3.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"include-path": [
|
||||
""
|
||||
],
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "Mock Object library for PHPUnit",
|
||||
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
|
||||
"keywords": [
|
||||
"mock",
|
||||
"xunit"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[](https://packagist.org/packages/phpunit/phpunit-mock-objects)
|
||||
[](https://travis-ci.org/sebastianbergmann/phpunit-mock-objects)
|
||||
[](https://travis-ci.org/sebastianbergmann/phpunit-mock-objects)
|
||||
|
||||
# PHPUnit_MockObject
|
||||
|
||||
|
@ -15,7 +15,7 @@ To add PHPUnit_MockObject as a local, per-project dependency to your project, si
|
|||
|
||||
{
|
||||
"require": {
|
||||
"phpunit/phpunit-mock-objects": "2.1.*"
|
||||
"phpunit/phpunit-mock-objects": "2.0.*"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.0/phpunit.xsd"
|
||||
bootstrap="../tests/bootstrap.php"
|
||||
backupGlobals="false"
|
||||
verbose="true">
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"phpunit/php-text-template": "~1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.1"
|
||||
"phpunit/phpunit": ">=4.0.0,<4.1.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-soap": "*"
|
||||
|
@ -36,7 +36,7 @@
|
|||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev"
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"include-path": [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.0/phpunit.xsd"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
backupGlobals="false"
|
||||
verbose="true">
|
||||
|
|
|
@ -212,12 +212,13 @@ class PHPUnit_Framework_MockObject_Builder_InvocationMocker implements PHPUnit_F
|
|||
}
|
||||
|
||||
/**
|
||||
* Validate that a parameters matcher can be defined, throw exceptions otherwise.
|
||||
*
|
||||
* @throws PHPUnit_Framework_Exception
|
||||
* @param mixed $argument, ...
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
private function canDefineParameters()
|
||||
public function with()
|
||||
{
|
||||
$args = func_get_args();
|
||||
|
||||
if ($this->matcher->methodNameMatcher === NULL) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
'Method name matcher is not defined, cannot define parameter ' .
|
||||
|
@ -230,45 +231,29 @@ class PHPUnit_Framework_MockObject_Builder_InvocationMocker implements PHPUnit_F
|
|||
'Parameter matcher is already defined, cannot redefine'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $argument, ...
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
public function with()
|
||||
{
|
||||
$args = func_get_args();
|
||||
|
||||
$this->canDefineParameters();
|
||||
|
||||
$this->matcher->parametersMatcher = new PHPUnit_Framework_MockObject_Matcher_Parameters($args);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed ...$argument
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
public function withConsecutive() {
|
||||
|
||||
$args = func_get_args();
|
||||
|
||||
$this->canDefineParameters();
|
||||
|
||||
$this->matcher->parametersMatcher =
|
||||
new PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters($args);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
public function withAnyParameters()
|
||||
{
|
||||
$this->canDefineParameters();
|
||||
if ($this->matcher->methodNameMatcher === NULL) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
'Method name matcher is not defined, cannot define parameter ' .
|
||||
'matcher without one'
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->matcher->parametersMatcher !== NULL) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
'Parameter matcher is already defined, cannot redefine'
|
||||
);
|
||||
}
|
||||
|
||||
$this->matcher->parametersMatcher = new PHPUnit_Framework_MockObject_Matcher_AnyParameters;
|
||||
|
||||
|
|
|
@ -274,15 +274,13 @@ class PHPUnit_Framework_MockObject_Generator
|
|||
$class = new ReflectionClass($className);
|
||||
$isInternal = $this->isInternalClass($class);
|
||||
|
||||
if ($isInternal && !$this->unserializeHackIsSupported()) {
|
||||
throw new PHPUnit_Framework_MockObject_RuntimeException(
|
||||
'Internal classes cannot be mocked without invoking their constructor in PHP ' . PHP_VERSION
|
||||
);
|
||||
}
|
||||
|
||||
if ($isInternal || !$hasNewInstanceWithoutConstructor) {
|
||||
$object = unserialize(
|
||||
sprintf('O:%d:"%s":0:{}', strlen($className), $className)
|
||||
sprintf('%s:%d:"%s":0:{}',
|
||||
(version_compare(PHP_VERSION, '5.4', '>') && $class->implementsInterface("Serializable") ? "C" : "O"),
|
||||
strlen($className),
|
||||
$className
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$object = $class->newInstanceWithoutConstructor();
|
||||
|
@ -1097,18 +1095,4 @@ class PHPUnit_Framework_MockObject_Generator
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @since Method available since Release 2.0.9
|
||||
*/
|
||||
private function unserializeHackIsSupported()
|
||||
{
|
||||
if (PHP_VERSION == '5.4.29' || PHP_VERSION == '5.5.13' ||
|
||||
version_compare(PHP_VERSION, '5.6.0', '>=')) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,162 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2014, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @copyright 2010-2014 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
*/
|
||||
|
||||
/**
|
||||
* Invocation matcher which looks for sets of specific parameters in the invocations.
|
||||
*
|
||||
* Checks the parameters of the incoming invocations, the parameter list is
|
||||
* checked against the defined constraints in $parameters. If the constraint
|
||||
* is met it will return true in matches().
|
||||
*
|
||||
* It takes a list of match groups and and increases a call index after each invocation.
|
||||
* So the first invocation uses the first group of constraints, the second the next and so on.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @copyright 2010-2014 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @version Release: @package_version@
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters
|
||||
extends PHPUnit_Framework_MockObject_Matcher_StatelessInvocation
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_parameterGroups = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_invocations = array();
|
||||
|
||||
/**
|
||||
* @param array $parameterGroups
|
||||
*/
|
||||
public function __construct(array $parameterGroups)
|
||||
{
|
||||
foreach ($parameterGroups as $index => $parameters) {
|
||||
foreach ($parameters as $parameter) {
|
||||
if (!($parameter instanceof \PHPUnit_Framework_Constraint))
|
||||
{
|
||||
$parameter = new \PHPUnit_Framework_Constraint_IsEqual($parameter);
|
||||
}
|
||||
$this->_parameterGroups[$index][] = $parameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
$text = 'with consecutive parameters';
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @return bool
|
||||
*/
|
||||
public function matches(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
$this->_invocations[] = $invocation;
|
||||
$callIndex = count($this->_invocations) - 1;
|
||||
$this->verifyInvocation($invocation, $callIndex);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public function verify()
|
||||
{
|
||||
foreach ($this->_invocations as $callIndex => $invocation) {
|
||||
$this->verifyInvocation($invocation, $callIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify a single invocation
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @param int $callIndex
|
||||
* @throws PHPUnit_Framework_ExpectationFailedException
|
||||
*/
|
||||
private function verifyInvocation(PHPUnit_Framework_MockObject_Invocation $invocation, $callIndex)
|
||||
{
|
||||
|
||||
if (isset($this->_parameterGroups[$callIndex])) {
|
||||
$parameters = $this->_parameterGroups[$callIndex];
|
||||
}
|
||||
|
||||
if ($invocation === NULL) {
|
||||
throw new PHPUnit_Framework_ExpectationFailedException(
|
||||
'Mocked method does not exist.'
|
||||
);
|
||||
}
|
||||
|
||||
if (count($invocation->parameters) < count($parameters)) {
|
||||
throw new PHPUnit_Framework_ExpectationFailedException(
|
||||
sprintf(
|
||||
'Parameter count for invocation %s is too low.',
|
||||
$invocation->toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($parameters as $i => $parameter) {
|
||||
$parameter->evaluate(
|
||||
$invocation->parameters[$i],
|
||||
sprintf(
|
||||
'Parameter %s for invocation #%d %s does not match expected ' .
|
||||
'value.',
|
||||
$i,
|
||||
$callIndex,
|
||||
$invocation->toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -110,7 +110,9 @@ class PHPUnit_Framework_MockObject_Matcher_Parameters extends PHPUnit_Framework_
|
|||
public function matches(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
$this->invocation = $invocation;
|
||||
return $this->verify();
|
||||
$this->verify();
|
||||
|
||||
return count($invocation->parameters) < count($this->parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,7 +156,5 @@ class PHPUnit_Framework_MockObject_Matcher_Parameters extends PHPUnit_Framework_
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
class Framework_MockObject_Matcher_ConsecutiveParametersTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testIntegration()
|
||||
{
|
||||
$mock = $this->getMock('stdClass', array('foo'));
|
||||
$mock
|
||||
->expects($this->any())
|
||||
->method('foo')
|
||||
->withConsecutive(
|
||||
array('bar'),
|
||||
array(21, 42)
|
||||
);
|
||||
$mock->foo('bar');
|
||||
$mock->foo(21, 42);
|
||||
}
|
||||
|
||||
public function testIntegrationExpectingException()
|
||||
{
|
||||
$mock = $this->getMock('stdClass', array('foo'));
|
||||
$mock
|
||||
->expects($this->any())
|
||||
->method('foo')
|
||||
->withConsecutive(
|
||||
array('bar'),
|
||||
array(21, 42)
|
||||
);
|
||||
$mock->foo('bar');
|
||||
$this->setExpectedException('PHPUnit_Framework_ExpectationFailedException');
|
||||
$mock->foo('invalid');
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ require __DIR__ . '/../../vendor/autoload.php';
|
|||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
print $generator->generateClassFromWsdl(
|
||||
dirname(dirname(__FILE__)) . '/_fixture/GoogleSearch.wsdl',
|
||||
dirname(dirname(__FILE__)) . '/_files/GoogleSearch.wsdl',
|
||||
'GoogleSearch'
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -11,7 +11,7 @@ require __DIR__ . '/../../vendor/autoload.php';
|
|||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
print $generator->generateClassFromWsdl(
|
||||
dirname(dirname(__FILE__)) . '/_fixture/GoogleSearch.wsdl',
|
||||
dirname(dirname(__FILE__)) . '/_files/GoogleSearch.wsdl',
|
||||
'My\\Space\\GoogleSearch'
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -11,7 +11,7 @@ require __DIR__ . '/../../vendor/autoload.php';
|
|||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
print $generator->generateClassFromWsdl(
|
||||
dirname(dirname(__FILE__)) . '/_fixture/GoogleSearch.wsdl',
|
||||
dirname(dirname(__FILE__)) . '/_files/GoogleSearch.wsdl',
|
||||
'GoogleSearch',
|
||||
array('doGoogleSearch')
|
||||
);
|
||||
|
|
|
@ -730,7 +730,7 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testCreateMockFromWsdl()
|
||||
{
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_fixture/GoogleSearch.wsdl', 'WsdlMock');
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_files/GoogleSearch.wsdl', 'WsdlMock');
|
||||
$this->assertStringStartsWith(
|
||||
'Mock_WsdlMock_',
|
||||
get_class($mock)
|
||||
|
@ -742,7 +742,7 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testCreateNamespacedMockFromWsdl()
|
||||
{
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_fixture/GoogleSearch.wsdl', 'My\\Space\\WsdlMock');
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_files/GoogleSearch.wsdl', 'My\\Space\\WsdlMock');
|
||||
$this->assertStringStartsWith(
|
||||
'Mock_WsdlMock_',
|
||||
get_class($mock)
|
||||
|
@ -754,8 +754,8 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testCreateTwoMocksOfOneWsdlFile()
|
||||
{
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_fixture/GoogleSearch.wsdl');
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_fixture/GoogleSearch.wsdl');
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_files/GoogleSearch.wsdl');
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_files/GoogleSearch.wsdl');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,29 +7,28 @@ spl_autoload_register(
|
|||
static $classes = null;
|
||||
if ($classes === null) {
|
||||
$classes = array(
|
||||
'abstractmocktestclass' => '/_fixture/AbstractMockTestClass.php',
|
||||
'abstracttrait' => '/_fixture/AbstractTrait.php',
|
||||
'aninterface' => '/_fixture/AnInterface.php',
|
||||
'anotherinterface' => '/_fixture/AnotherInterface.php',
|
||||
'bar' => '/_fixture/Bar.php',
|
||||
'abstractmocktestclass' => '/_files/AbstractMockTestClass.php',
|
||||
'abstracttrait' => '/_files/AbstractTrait.php',
|
||||
'aninterface' => '/_files/AnInterface.php',
|
||||
'anotherinterface' => '/_files/AnotherInterface.php',
|
||||
'bar' => '/_files/Bar.php',
|
||||
'classthatimplementsserializable' => '/_files/ClassThatImplementsSerializable.php',
|
||||
'classwithstaticmethod' => '/_files/ClassWithStaticMethod.php',
|
||||
'foo' => '/_fixture/Foo.php',
|
||||
'foo' => '/_files/Foo.php',
|
||||
'framework_mockbuildertest' => '/MockBuilderTest.php',
|
||||
'framework_mockobject_generatortest' => '/GeneratorTest.php',
|
||||
'framework_mockobject_invocation_objecttest' => '/MockObject/Invocation/ObjectTest.php',
|
||||
'framework_mockobject_invocation_statictest' => '/MockObject/Invocation/StaticTest.php',
|
||||
'framework_mockobject_matcher_consecutiveparameterstest' => '/MockObject/Matcher/ConsecutiveParametersTest.php',
|
||||
'framework_mockobjecttest' => '/MockObjectTest.php',
|
||||
'framework_proxyobjecttest' => '/ProxyObjectTest.php',
|
||||
'interfacewithstaticmethod' => '/_fixture/InterfaceWithStaticMethod.php',
|
||||
'methodcallback' => '/_fixture/MethodCallback.php',
|
||||
'methodcallbackbyreference' => '/_fixture/MethodCallbackByReference.php',
|
||||
'mockable' => '/_fixture/Mockable.php',
|
||||
'partialmocktestclass' => '/_fixture/PartialMockTestClass.php',
|
||||
'someclass' => '/_fixture/SomeClass.php',
|
||||
'staticmocktestclass' => '/_fixture/StaticMockTestClass.php',
|
||||
'traversablemocktestinterface' => '/_fixture/TraversableMockTestInterface.php'
|
||||
'interfacewithstaticmethod' => '/_files/InterfaceWithStaticMethod.php',
|
||||
'methodcallback' => '/_files/MethodCallback.php',
|
||||
'methodcallbackbyreference' => '/_files/MethodCallbackByReference.php',
|
||||
'mockable' => '/_files/Mockable.php',
|
||||
'partialmocktestclass' => '/_files/PartialMockTestClass.php',
|
||||
'someclass' => '/_files/SomeClass.php',
|
||||
'staticmocktestclass' => '/_files/StaticMockTestClass.php',
|
||||
'traversablemocktestinterface' => '/_files/TraversableMockTestInterface.php'
|
||||
);
|
||||
}
|
||||
$cn = strtolower($class);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require __DIR__ . '/autoload.php';
|
||||
require __DIR__ . '/_fixture/FunctionCallback.php';
|
||||
require __DIR__ . '/_files/FunctionCallback.php';
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
|
|
Loading…
Reference in New Issue