Kohana v3.3.0
This commit is contained in:
100
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Autoload.php
vendored
Normal file
100
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Autoload.php
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2002-2011, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2002-2011 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.1.0
|
||||
*/
|
||||
|
||||
spl_autoload_register(
|
||||
function ($class)
|
||||
{
|
||||
static $classes = NULL;
|
||||
static $path = NULL;
|
||||
|
||||
if ($classes === NULL) {
|
||||
$classes = array(
|
||||
'phpunit_framework_mockobject_builder_identity' => '/Framework/MockObject/Builder/Identity.php',
|
||||
'phpunit_framework_mockobject_builder_invocationmocker' => '/Framework/MockObject/Builder/InvocationMocker.php',
|
||||
'phpunit_framework_mockobject_builder_match' => '/Framework/MockObject/Builder/Match.php',
|
||||
'phpunit_framework_mockobject_builder_methodnamematch' => '/Framework/MockObject/Builder/MethodNameMatch.php',
|
||||
'phpunit_framework_mockobject_builder_namespace' => '/Framework/MockObject/Builder/Namespace.php',
|
||||
'phpunit_framework_mockobject_builder_parametersmatch' => '/Framework/MockObject/Builder/ParametersMatch.php',
|
||||
'phpunit_framework_mockobject_builder_stub' => '/Framework/MockObject/Builder/Stub.php',
|
||||
'phpunit_framework_mockobject_generator' => '/Framework/MockObject/Generator.php',
|
||||
'phpunit_framework_mockobject_invocation' => '/Framework/MockObject/Invocation.php',
|
||||
'phpunit_framework_mockobject_invocation_object' => '/Framework/MockObject/Invocation/Object.php',
|
||||
'phpunit_framework_mockobject_invocation_static' => '/Framework/MockObject/Invocation/Static.php',
|
||||
'phpunit_framework_mockobject_invocationmocker' => '/Framework/MockObject/InvocationMocker.php',
|
||||
'phpunit_framework_mockobject_invokable' => '/Framework/MockObject/Invokable.php',
|
||||
'phpunit_framework_mockobject_matcher' => '/Framework/MockObject/Matcher.php',
|
||||
'phpunit_framework_mockobject_matcher_anyinvokedcount' => '/Framework/MockObject/Matcher/AnyInvokedCount.php',
|
||||
'phpunit_framework_mockobject_matcher_anyparameters' => '/Framework/MockObject/Matcher/AnyParameters.php',
|
||||
'phpunit_framework_mockobject_matcher_invocation' => '/Framework/MockObject/Matcher/Invocation.php',
|
||||
'phpunit_framework_mockobject_matcher_invokedatindex' => '/Framework/MockObject/Matcher/InvokedAtIndex.php',
|
||||
'phpunit_framework_mockobject_matcher_invokedatleastonce' => '/Framework/MockObject/Matcher/InvokedAtLeastOnce.php',
|
||||
'phpunit_framework_mockobject_matcher_invokedcount' => '/Framework/MockObject/Matcher/InvokedCount.php',
|
||||
'phpunit_framework_mockobject_matcher_invokedrecorder' => '/Framework/MockObject/Matcher/InvokedRecorder.php',
|
||||
'phpunit_framework_mockobject_matcher_methodname' => '/Framework/MockObject/Matcher/MethodName.php',
|
||||
'phpunit_framework_mockobject_matcher_parameters' => '/Framework/MockObject/Matcher/Parameters.php',
|
||||
'phpunit_framework_mockobject_matcher_statelessinvocation' => '/Framework/MockObject/Matcher/StatelessInvocation.php',
|
||||
'phpunit_framework_mockobject_mockbuilder' => '/Framework/MockObject/MockBuilder.php',
|
||||
'phpunit_framework_mockobject_mockobject' => '/Framework/MockObject/MockObject.php',
|
||||
'phpunit_framework_mockobject_stub' => '/Framework/MockObject/Stub.php',
|
||||
'phpunit_framework_mockobject_stub_consecutivecalls' => '/Framework/MockObject/Stub/ConsecutiveCalls.php',
|
||||
'phpunit_framework_mockobject_stub_exception' => '/Framework/MockObject/Stub/Exception.php',
|
||||
'phpunit_framework_mockobject_stub_matchercollection' => '/Framework/MockObject/Stub/MatcherCollection.php',
|
||||
'phpunit_framework_mockobject_stub_return' => '/Framework/MockObject/Stub/Return.php',
|
||||
'phpunit_framework_mockobject_stub_returnargument' => '/Framework/MockObject/Stub/ReturnArgument.php',
|
||||
'phpunit_framework_mockobject_stub_returncallback' => '/Framework/MockObject/Stub/ReturnCallback.php',
|
||||
'phpunit_framework_mockobject_stub_returnself' => '/Framework/MockObject/Stub/ReturnSelf.php',
|
||||
'phpunit_framework_mockobject_stub_returnvaluemap' => '/Framework/MockObject/Stub/ReturnValueMap.php',
|
||||
'phpunit_framework_mockobject_verifiable' => '/Framework/MockObject/Verifiable.php'
|
||||
);
|
||||
|
||||
$path = dirname(dirname(dirname(__FILE__)));
|
||||
}
|
||||
|
||||
$cn = strtolower($class);
|
||||
|
||||
if (isset($classes[$cn])) {
|
||||
require $path . $classes[$cn];
|
||||
}
|
||||
}
|
||||
);
|
65
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Autoload.php.in
vendored
Normal file
65
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Autoload.php.in
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2002-2011, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2002-2011 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.1.0
|
||||
*/
|
||||
|
||||
spl_autoload_register(
|
||||
function ($class)
|
||||
{
|
||||
static $classes = NULL;
|
||||
static $path = NULL;
|
||||
|
||||
if ($classes === NULL) {
|
||||
$classes = array(
|
||||
___CLASSLIST___
|
||||
);
|
||||
|
||||
$path = dirname(dirname(dirname(__FILE__)));
|
||||
}
|
||||
|
||||
$cn = strtolower($class);
|
||||
|
||||
if (isset($classes[$cn])) {
|
||||
require $path . $classes[$cn];
|
||||
}
|
||||
}
|
||||
);
|
70
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/Identity.php
vendored
Normal file
70
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/Identity.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Builder interface for unique identifiers.
|
||||
*
|
||||
* Defines the interface for recording unique identifiers. The identifiers
|
||||
* can be used to define the invocation order of expectations. The expectation
|
||||
* is recorded using id() and then defined in order using
|
||||
* PHPUnit_Framework_MockObject_Builder_Match::after().
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Builder_Identity
|
||||
{
|
||||
/**
|
||||
* Sets the identification of the expectation to $id.
|
||||
*
|
||||
* @note The identifier is unique per mock object.
|
||||
* @param string $id Unique identifiation of expectation.
|
||||
*/
|
||||
public function id($id);
|
||||
}
|
193
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/InvocationMocker.php
vendored
Normal file
193
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/InvocationMocker.php
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Builder for mocked or stubbed invocations.
|
||||
*
|
||||
* Provides methods for building expectations without having to resort to
|
||||
* instantiating the various matchers manually. These methods also form a
|
||||
* more natural way of reading the expectation. This class should be together
|
||||
* with the test case PHPUnit_Framework_MockObject_TestCase.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Builder_InvocationMocker implements PHPUnit_Framework_MockObject_Builder_MethodNameMatch
|
||||
{
|
||||
/**
|
||||
* @var PHPUnit_Framework_MockObject_Stub_MatcherCollection
|
||||
*/
|
||||
protected $collection;
|
||||
|
||||
/**
|
||||
* @var PHPUnit_Framework_MockObject_Matcher
|
||||
*/
|
||||
protected $matcher;
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Stub_MatcherCollection $collection
|
||||
* @param PHPUnit_Framework_MockObject_Matcher_Invocation $invocationMatcher
|
||||
*/
|
||||
public function __construct(PHPUnit_Framework_MockObject_Stub_MatcherCollection $collection, PHPUnit_Framework_MockObject_Matcher_Invocation $invocationMatcher)
|
||||
{
|
||||
$this->collection = $collection;
|
||||
$this->matcher = new PHPUnit_Framework_MockObject_Matcher(
|
||||
$invocationMatcher
|
||||
);
|
||||
|
||||
$this->collection->addMatcher($this->matcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Framework_MockObject_Matcher
|
||||
*/
|
||||
public function getMatcher()
|
||||
{
|
||||
return $this->matcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
public function id($id)
|
||||
{
|
||||
$this->collection->registerId($id, $this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Stub $stub
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
public function will(PHPUnit_Framework_MockObject_Stub $stub)
|
||||
{
|
||||
$this->matcher->stub = $stub;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
public function after($id)
|
||||
{
|
||||
$this->matcher->afterMatchBuilderId = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $argument, ...
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
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 ' .
|
||||
' 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_Parameters($args);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
public function withAnyParameters()
|
||||
{
|
||||
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;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_Constraint|string $constraint
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
public function method($constraint)
|
||||
{
|
||||
if ($this->matcher->methodNameMatcher !== NULL) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
'Method name matcher is already defined, cannot redefine'
|
||||
);
|
||||
}
|
||||
|
||||
$this->matcher->methodNameMatcher = new PHPUnit_Framework_MockObject_Matcher_MethodName($constraint);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
66
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/Match.php
vendored
Normal file
66
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/Match.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Builder interface for invocation order matches.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Builder_Match extends PHPUnit_Framework_MockObject_Builder_Stub
|
||||
{
|
||||
/**
|
||||
* Defines the expectation which must occur before the current is valid.
|
||||
*
|
||||
* @param string $id The identification of the expectation that should
|
||||
* occur before this one.
|
||||
* @return PHPUnit_Framework_MockObject_Builder_Stub
|
||||
*/
|
||||
public function after($id);
|
||||
}
|
68
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/MethodNameMatch.php
vendored
Normal file
68
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/MethodNameMatch.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Builder interface for matcher of method names.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Builder_MethodNameMatch extends PHPUnit_Framework_MockObject_Builder_ParametersMatch
|
||||
{
|
||||
/**
|
||||
* Adds a new method name match and returns the parameter match object for
|
||||
* further matching possibilities.
|
||||
*
|
||||
* @param PHPUnit_Framework_Constraint $name
|
||||
* Constraint for matching method, if a string is passed it will use
|
||||
* the PHPUnit_Framework_Constraint_IsEqual.
|
||||
* @return PHPUnit_Framework_MockObject_Builder_ParametersMatch
|
||||
*/
|
||||
public function method($name);
|
||||
}
|
79
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/Namespace.php
vendored
Normal file
79
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/Namespace.php
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for builders which can register builders with a given identification.
|
||||
*
|
||||
* This interface relates to PHPUnit_Framework_MockObject_Builder_Identity.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Builder_Namespace
|
||||
{
|
||||
/**
|
||||
* Looks up the match builder with identification $id and returns it.
|
||||
*
|
||||
* @param string $id The identifiction of the match builder.
|
||||
* @return PHPUnit_Framework_MockObject_Builder_Match
|
||||
*/
|
||||
public function lookupId($id);
|
||||
|
||||
/**
|
||||
* Registers the match builder $builder with the identification $id. The
|
||||
* builder can later be looked up using lookupId() to figure out if it
|
||||
* has been invoked.
|
||||
*
|
||||
* @param string $id
|
||||
* The identification of the match builder.
|
||||
* @param PHPUnit_Framework_MockObject_Builder_Match $builder
|
||||
* The builder which is being registered.
|
||||
*/
|
||||
public function registerId($id, PHPUnit_Framework_MockObject_Builder_Match $builder);
|
||||
}
|
89
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/ParametersMatch.php
vendored
Normal file
89
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/ParametersMatch.php
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Builder interface for parameter matchers.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Builder_ParametersMatch extends PHPUnit_Framework_MockObject_Builder_Match
|
||||
{
|
||||
/**
|
||||
* Sets the parameters to match for, each parameter to this funtion will
|
||||
* be part of match. To perform specific matches or constraints create a
|
||||
* new PHPUnit_Framework_Constraint and use it for the parameter.
|
||||
* If the parameter value is not a constraint it will use the
|
||||
* PHPUnit_Framework_Constraint_IsEqual for the value.
|
||||
*
|
||||
* Some examples:
|
||||
* <code>
|
||||
* // match first parameter with value 2
|
||||
* $b->with(2);
|
||||
* // match first parameter with value 'smock' and second identical to 42
|
||||
* $b->with('smock', new PHPUnit_Framework_Constraint_IsEqual(42));
|
||||
* </code>
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_Builder_ParametersMatch
|
||||
*/
|
||||
public function with();
|
||||
|
||||
/**
|
||||
* Sets a matcher which allows any kind of parameters.
|
||||
*
|
||||
* Some examples:
|
||||
* <code>
|
||||
* // match any number of parameters
|
||||
* $b->withAnyParamers();
|
||||
* </code>
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_Matcher_AnyParameters
|
||||
*/
|
||||
public function withAnyParameters();
|
||||
}
|
66
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/Stub.php
vendored
Normal file
66
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Builder/Stub.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Builder interface for stubs which are actions replacing an invocation.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Builder_Stub extends PHPUnit_Framework_MockObject_Builder_Identity
|
||||
{
|
||||
/**
|
||||
* Stubs the matching method with the stub object $stub. Any invocations of
|
||||
* the matched method will now be handled by the stub instead.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Stub $stub The stub object.
|
||||
* @return PHPUnit_Framework_MockObject_Builder_Identity
|
||||
*/
|
||||
public function will(PHPUnit_Framework_MockObject_Stub $stub);
|
||||
}
|
811
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Generator.php
vendored
Normal file
811
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Generator.php
vendored
Normal file
@@ -0,0 +1,811 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mock Object Code Generator
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Generator
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $cache = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $blacklistedMethodNames = array(
|
||||
'__clone' => TRUE,
|
||||
'abstract' => TRUE,
|
||||
'and' => TRUE,
|
||||
'array' => TRUE,
|
||||
'as' => TRUE,
|
||||
'break' => TRUE,
|
||||
'case' => TRUE,
|
||||
'catch' => TRUE,
|
||||
'class' => TRUE,
|
||||
'clone' => TRUE,
|
||||
'const' => TRUE,
|
||||
'continue' => TRUE,
|
||||
'declare' => TRUE,
|
||||
'default' => TRUE,
|
||||
'die' => TRUE,
|
||||
'do' => TRUE,
|
||||
'echo' => TRUE,
|
||||
'else' => TRUE,
|
||||
'elseif' => TRUE,
|
||||
'empty' => TRUE,
|
||||
'enddeclare' => TRUE,
|
||||
'endfor' => TRUE,
|
||||
'endforeach' => TRUE,
|
||||
'endif' => TRUE,
|
||||
'endswitch' => TRUE,
|
||||
'endwhile' => TRUE,
|
||||
'eval' => TRUE,
|
||||
'exit' => TRUE,
|
||||
'expects' => TRUE,
|
||||
'extends' => TRUE,
|
||||
'final' => TRUE,
|
||||
'for' => TRUE,
|
||||
'foreach' => TRUE,
|
||||
'function' => TRUE,
|
||||
'global' => TRUE,
|
||||
'goto' => TRUE,
|
||||
'if' => TRUE,
|
||||
'implements' => TRUE,
|
||||
'include' => TRUE,
|
||||
'include_once' => TRUE,
|
||||
'instanceof' => TRUE,
|
||||
'interface' => TRUE,
|
||||
'isset' => TRUE,
|
||||
'list' => TRUE,
|
||||
'namespace' => TRUE,
|
||||
'new' => TRUE,
|
||||
'or' => TRUE,
|
||||
'print' => TRUE,
|
||||
'private' => TRUE,
|
||||
'protected' => TRUE,
|
||||
'public' => TRUE,
|
||||
'require' => TRUE,
|
||||
'require_once' => TRUE,
|
||||
'return' => TRUE,
|
||||
'static' => TRUE,
|
||||
'staticExpects' => TRUE,
|
||||
'switch' => TRUE,
|
||||
'throw' => TRUE,
|
||||
'try' => TRUE,
|
||||
'unset' => TRUE,
|
||||
'use' => TRUE,
|
||||
'var' => TRUE,
|
||||
'while' => TRUE,
|
||||
'xor' => TRUE
|
||||
);
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $soapLoaded = NULL;
|
||||
|
||||
/**
|
||||
* Returns a mock object for the specified class.
|
||||
*
|
||||
* @param string $originalClassName
|
||||
* @param array $methods
|
||||
* @param array $arguments
|
||||
* @param string $mockClassName
|
||||
* @param boolean $callOriginalConstructor
|
||||
* @param boolean $callOriginalClone
|
||||
* @param boolean $callAutoload
|
||||
* @param boolean $cloneArguments
|
||||
* @return object
|
||||
* @throws InvalidArgumentException
|
||||
* @since Method available since Release 1.0.0
|
||||
*/
|
||||
public static function getMock($originalClassName, $methods = array(), array $arguments = array(), $mockClassName = '', $callOriginalConstructor = TRUE, $callOriginalClone = TRUE, $callAutoload = TRUE, $cloneArguments = TRUE)
|
||||
{
|
||||
if (!is_string($originalClassName)) {
|
||||
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
|
||||
}
|
||||
|
||||
if (!is_string($mockClassName)) {
|
||||
throw PHPUnit_Util_InvalidArgumentHelper::factory(4, 'string');
|
||||
}
|
||||
|
||||
if (!is_array($methods) && !is_null($methods)) {
|
||||
throw new InvalidArgumentException;
|
||||
}
|
||||
|
||||
if (NULL !== $methods) {
|
||||
foreach ($methods as $method) {
|
||||
if (!preg_match('~[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*~', $method)) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
sprintf(
|
||||
'Cannot stub or mock method with invalid name "%s"',
|
||||
$method
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($methods != array_unique($methods)) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
sprintf(
|
||||
'Cannot stub or mock using a method list that contains duplicates: "%s"',
|
||||
implode(', ', $methods)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($mockClassName != '' && class_exists($mockClassName, FALSE)) {
|
||||
$reflect = new ReflectionClass($mockClassName);
|
||||
if (!$reflect->implementsInterface("PHPUnit_Framework_MockObject_MockObject")) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
sprintf(
|
||||
'Class "%s" already exists.',
|
||||
$mockClassName
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$mock = self::generate(
|
||||
$originalClassName,
|
||||
$methods,
|
||||
$mockClassName,
|
||||
$callOriginalClone,
|
||||
$callAutoload,
|
||||
$cloneArguments
|
||||
);
|
||||
|
||||
return self::getObject(
|
||||
$mock['code'],
|
||||
$mock['mockClassName'],
|
||||
$originalClassName,
|
||||
$callOriginalConstructor,
|
||||
$callAutoload,
|
||||
$arguments
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @param string $className
|
||||
* @param string $originalClassName
|
||||
* @param string $callOriginalConstructor
|
||||
* @param string $callAutoload
|
||||
* @param array $arguments
|
||||
* @return object
|
||||
*/
|
||||
protected static function getObject($code, $className, $originalClassName = '', $callOriginalConstructor = FALSE, $callAutoload = FALSE, array $arguments = array())
|
||||
{
|
||||
if (!class_exists($className, FALSE)) {
|
||||
eval($code);
|
||||
}
|
||||
|
||||
if ($callOriginalConstructor &&
|
||||
!interface_exists($originalClassName, $callAutoload)) {
|
||||
if (count($arguments) == 0) {
|
||||
$object = new $className;
|
||||
} else {
|
||||
$class = new ReflectionClass($className);
|
||||
$object = $class->newInstanceArgs($arguments);
|
||||
}
|
||||
} else {
|
||||
// Use a trick to create a new object of a class
|
||||
// without invoking its constructor.
|
||||
$object = unserialize(
|
||||
sprintf('O:%d:"%s":0:{}', strlen($className), $className)
|
||||
);
|
||||
}
|
||||
|
||||
if ($object instanceof PHPUnit_Framework_MockObject_MockObject) {
|
||||
$object->__phpunit_setId();
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mock object for the specified abstract class with all abstract
|
||||
* methods of the class mocked. Concrete methods to mock can be specified with
|
||||
* the last parameter
|
||||
*
|
||||
* @param string $originalClassName
|
||||
* @param array $arguments
|
||||
* @param string $mockClassName
|
||||
* @param boolean $callOriginalConstructor
|
||||
* @param boolean $callOriginalClone
|
||||
* @param boolean $callAutoload
|
||||
* @param array $mockedMethods
|
||||
* @param boolean $cloneArguments
|
||||
* @return object
|
||||
* @since Method available since Release 1.0.0
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public static function getMockForAbstractClass($originalClassName, array $arguments = array(), $mockClassName = '', $callOriginalConstructor = TRUE, $callOriginalClone = TRUE, $callAutoload = TRUE, $mockedMethods = array(), $cloneArguments = TRUE)
|
||||
{
|
||||
if (!is_string($originalClassName)) {
|
||||
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
|
||||
}
|
||||
|
||||
if (!is_string($mockClassName)) {
|
||||
throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'string');
|
||||
}
|
||||
|
||||
if (class_exists($originalClassName, $callAutoload) ||
|
||||
interface_exists($originalClassName, $callAutoload)) {
|
||||
$methods = array();
|
||||
$reflector = new ReflectionClass($originalClassName);
|
||||
|
||||
foreach ($reflector->getMethods() as $method) {
|
||||
if ($method->isAbstract() || in_array($method->getName(), $mockedMethods)) {
|
||||
$methods[] = $method->getName();
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($methods)) {
|
||||
$methods = NULL;
|
||||
}
|
||||
|
||||
return self::getMock(
|
||||
$originalClassName,
|
||||
$methods,
|
||||
$arguments,
|
||||
$mockClassName,
|
||||
$callOriginalConstructor,
|
||||
$callOriginalClone,
|
||||
$callAutoload,
|
||||
$cloneArguments
|
||||
);
|
||||
} else {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
sprintf(
|
||||
'Class "%s" does not exist.',
|
||||
$originalClassName
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object for the specified trait.
|
||||
*
|
||||
* @param string $traitName
|
||||
* @param array $arguments
|
||||
* @param string $traitClassName
|
||||
* @param boolean $callOriginalConstructor
|
||||
* @param boolean $callOriginalClone
|
||||
* @param boolean $callAutoload
|
||||
* @return object
|
||||
* @since Method available since Release 1.1.0
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public static function getObjectForTrait($traitName, array $arguments = array(), $traitClassName = '', $callOriginalConstructor = TRUE, $callOriginalClone = TRUE, $callAutoload = TRUE)
|
||||
{
|
||||
if (!is_string($traitName)) {
|
||||
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
|
||||
}
|
||||
|
||||
if (!is_string($traitClassName)) {
|
||||
throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'string');
|
||||
}
|
||||
|
||||
if (!trait_exists($traitName, $callAutoload)) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
sprintf(
|
||||
'Trait "%s" does not exist.',
|
||||
$traitName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$className = self::generateClassName(
|
||||
$traitName, $traitClassName, 'Trait_'
|
||||
);
|
||||
|
||||
$templateDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Generator' .
|
||||
DIRECTORY_SEPARATOR;
|
||||
$classTemplate = new Text_Template(
|
||||
$templateDir . 'trait_class.tpl'
|
||||
);
|
||||
|
||||
$classTemplate->setVar(
|
||||
array(
|
||||
'class_name' => $className['className'],
|
||||
'trait_name' => $traitName
|
||||
)
|
||||
);
|
||||
|
||||
return self::getObject(
|
||||
$classTemplate->render(),
|
||||
$className['className']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $originalClassName
|
||||
* @param array $methods
|
||||
* @param string $mockClassName
|
||||
* @param boolean $callOriginalClone
|
||||
* @param boolean $callAutoload
|
||||
* @param boolean $cloneArguments
|
||||
* @return array
|
||||
*/
|
||||
public static function generate($originalClassName, array $methods = NULL, $mockClassName = '', $callOriginalClone = TRUE, $callAutoload = TRUE, $cloneArguments = TRUE)
|
||||
{
|
||||
if ($mockClassName == '') {
|
||||
$key = md5(
|
||||
$originalClassName .
|
||||
serialize($methods) .
|
||||
serialize($callOriginalClone)
|
||||
);
|
||||
|
||||
if (isset(self::$cache[$key])) {
|
||||
return self::$cache[$key];
|
||||
}
|
||||
}
|
||||
|
||||
$mock = self::generateMock(
|
||||
$originalClassName,
|
||||
$methods,
|
||||
$mockClassName,
|
||||
$callOriginalClone,
|
||||
$callAutoload,
|
||||
$cloneArguments
|
||||
);
|
||||
|
||||
if (isset($key)) {
|
||||
self::$cache[$key] = $mock;
|
||||
}
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $wsdlFile
|
||||
* @param string $originalClassName
|
||||
* @param array $methods
|
||||
* @param array $options
|
||||
* @return array
|
||||
*/
|
||||
public static function generateClassFromWsdl($wsdlFile, $originalClassName, array $methods = array(), array $options = array())
|
||||
{
|
||||
if (self::$soapLoaded === NULL) {
|
||||
self::$soapLoaded = extension_loaded('soap');
|
||||
}
|
||||
|
||||
if (self::$soapLoaded) {
|
||||
$client = new SOAPClient($wsdlFile, $options);
|
||||
$_methods = array_unique($client->__getFunctions());
|
||||
unset($client);
|
||||
|
||||
$templateDir = dirname(__FILE__) . DIRECTORY_SEPARATOR .
|
||||
'Generator' . DIRECTORY_SEPARATOR;
|
||||
$methodTemplate = new Text_Template(
|
||||
$templateDir . 'wsdl_method.tpl'
|
||||
);
|
||||
$methodsBuffer = '';
|
||||
|
||||
foreach ($_methods as $method) {
|
||||
$nameStart = strpos($method, ' ') + 1;
|
||||
$nameEnd = strpos($method, '(');
|
||||
$name = substr($method, $nameStart, $nameEnd - $nameStart);
|
||||
|
||||
if (empty($methods) || in_array($name, $methods)) {
|
||||
$args = explode(
|
||||
',',
|
||||
substr(
|
||||
$method,
|
||||
$nameEnd + 1,
|
||||
strpos($method, ')') - $nameEnd - 1
|
||||
)
|
||||
);
|
||||
$numArgs = count($args);
|
||||
|
||||
for ($i = 0; $i < $numArgs; $i++) {
|
||||
$args[$i] = substr($args[$i], strpos($args[$i], '$'));
|
||||
}
|
||||
|
||||
$methodTemplate->setVar(
|
||||
array(
|
||||
'method_name' => $name,
|
||||
'arguments' => join(', ', $args)
|
||||
)
|
||||
);
|
||||
|
||||
$methodsBuffer .= $methodTemplate->render();
|
||||
}
|
||||
}
|
||||
|
||||
$optionsBuffer = 'array(';
|
||||
foreach ($options as $key => $value) {
|
||||
$optionsBuffer .= $key . ' => ' . $value;
|
||||
}
|
||||
|
||||
$optionsBuffer .= ')';
|
||||
|
||||
$classTemplate = new Text_Template(
|
||||
$templateDir . 'wsdl_class.tpl'
|
||||
);
|
||||
|
||||
$namespace = '';
|
||||
if(strpos($originalClassName, '\\') !== FALSE) {
|
||||
$parts = explode('\\', $originalClassName);
|
||||
$originalClassName = array_pop($parts);
|
||||
$namespace = 'namespace ' . join('\\', $parts) . ';';
|
||||
}
|
||||
|
||||
$classTemplate->setVar(
|
||||
array(
|
||||
'namespace' => $namespace,
|
||||
'class_name' => $originalClassName,
|
||||
'wsdl' => $wsdlFile,
|
||||
'options' => $optionsBuffer,
|
||||
'methods' => $methodsBuffer
|
||||
)
|
||||
);
|
||||
|
||||
return $classTemplate->render();
|
||||
} else {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
'The SOAP extension is required to generate a mock object ' .
|
||||
'from WSDL.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $originalClassName
|
||||
* @param array|null $methods
|
||||
* @param string $mockClassName
|
||||
* @param boolean $callOriginalClone
|
||||
* @param boolean $callAutoload
|
||||
* @param boolean $cloneArguments
|
||||
* @return array
|
||||
*/
|
||||
protected static function generateMock($originalClassName, $methods, $mockClassName, $callOriginalClone, $callAutoload, $cloneArguments = TRUE)
|
||||
{
|
||||
$templateDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Generator' .
|
||||
DIRECTORY_SEPARATOR;
|
||||
$classTemplate = new Text_Template(
|
||||
$templateDir . 'mocked_class.tpl'
|
||||
);
|
||||
$cloneTemplate = '';
|
||||
$isClass = FALSE;
|
||||
$isInterface = FALSE;
|
||||
|
||||
$mockClassName = self::generateClassName(
|
||||
$originalClassName, $mockClassName, 'Mock_'
|
||||
);
|
||||
|
||||
if (class_exists($mockClassName['fullClassName'], $callAutoload)) {
|
||||
$isClass = TRUE;
|
||||
} else {
|
||||
if (interface_exists($mockClassName['fullClassName'], $callAutoload)) {
|
||||
$isInterface = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists($mockClassName['fullClassName'], $callAutoload) &&
|
||||
!interface_exists($mockClassName['fullClassName'], $callAutoload)) {
|
||||
$prologue = 'class ' . $mockClassName['originalClassName'] . "\n{\n}\n\n";
|
||||
|
||||
if (!empty($mockClassName['namespaceName'])) {
|
||||
$prologue = 'namespace ' . $mockClassName['namespaceName'] .
|
||||
" {\n\n" . $prologue . "}\n\n" .
|
||||
"namespace {\n\n";
|
||||
|
||||
$epilogue = "\n\n}";
|
||||
}
|
||||
|
||||
$cloneTemplate = new Text_Template(
|
||||
$templateDir . 'mocked_clone.tpl'
|
||||
);
|
||||
} else {
|
||||
$class = new ReflectionClass($mockClassName['fullClassName']);
|
||||
|
||||
if ($class->isFinal()) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
sprintf(
|
||||
'Class "%s" is declared "final" and cannot be mocked.',
|
||||
$mockClassName['fullClassName']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($class->hasMethod('__clone')) {
|
||||
$cloneMethod = $class->getMethod('__clone');
|
||||
|
||||
if (!$cloneMethod->isFinal()) {
|
||||
if ($callOriginalClone && !$isInterface) {
|
||||
$cloneTemplate = new Text_Template(
|
||||
$templateDir . 'unmocked_clone.tpl'
|
||||
);
|
||||
} else {
|
||||
$cloneTemplate = new Text_Template(
|
||||
$templateDir . 'mocked_clone.tpl'
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$cloneTemplate = new Text_Template(
|
||||
$templateDir . 'mocked_clone.tpl'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_object($cloneTemplate)) {
|
||||
$cloneTemplate = $cloneTemplate->render();
|
||||
}
|
||||
|
||||
if (is_array($methods) && empty($methods) &&
|
||||
($isClass || $isInterface)) {
|
||||
$methods = get_class_methods($mockClassName['fullClassName']);
|
||||
}
|
||||
|
||||
if (!is_array($methods)) {
|
||||
$methods = array();
|
||||
}
|
||||
|
||||
$mockedMethods = '';
|
||||
|
||||
if (isset($class)) {
|
||||
foreach ($methods as $methodName) {
|
||||
try {
|
||||
$method = $class->getMethod($methodName);
|
||||
|
||||
if (self::canMockMethod($method)) {
|
||||
$mockedMethods .= self::generateMockedMethodDefinitionFromExisting(
|
||||
$templateDir, $method, $cloneArguments
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
catch (ReflectionException $e) {
|
||||
$mockedMethods .= self::generateMockedMethodDefinition(
|
||||
$templateDir, $mockClassName['fullClassName'], $methodName, $cloneArguments
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($methods as $methodName) {
|
||||
$mockedMethods .= self::generateMockedMethodDefinition(
|
||||
$templateDir, $mockClassName['fullClassName'], $methodName, $cloneArguments
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$classTemplate->setVar(
|
||||
array(
|
||||
'prologue' => isset($prologue) ? $prologue : '',
|
||||
'epilogue' => isset($epilogue) ? $epilogue : '',
|
||||
'class_declaration' => self::generateMockClassDeclaration(
|
||||
$mockClassName, $isInterface
|
||||
),
|
||||
'clone' => $cloneTemplate,
|
||||
'mock_class_name' => $mockClassName['className'],
|
||||
'mocked_methods' => $mockedMethods
|
||||
)
|
||||
);
|
||||
|
||||
return array(
|
||||
'code' => $classTemplate->render(),
|
||||
'mockClassName' => $mockClassName['className']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $originalClassName
|
||||
* @param string $className
|
||||
* @param string $prefix
|
||||
* @return array
|
||||
*/
|
||||
protected static function generateClassName($originalClassName, $className, $prefix)
|
||||
{
|
||||
if ($originalClassName[0] == '\\') {
|
||||
$originalClassName = substr($originalClassName, 1);
|
||||
}
|
||||
|
||||
$classNameParts = explode('\\', $originalClassName);
|
||||
|
||||
if (count($classNameParts) > 1) {
|
||||
$originalClassName = array_pop($classNameParts);
|
||||
$namespaceName = join('\\', $classNameParts);
|
||||
$fullClassName = $namespaceName . '\\' . $originalClassName;
|
||||
} else {
|
||||
$namespaceName = '';
|
||||
$fullClassName = $originalClassName;
|
||||
}
|
||||
|
||||
if ($className == '') {
|
||||
do {
|
||||
$className = $prefix . $originalClassName . '_' .
|
||||
substr(md5(microtime()), 0, 8);
|
||||
}
|
||||
while (class_exists($className, FALSE));
|
||||
}
|
||||
|
||||
return array(
|
||||
'className' => $className,
|
||||
'originalClassName' => $originalClassName,
|
||||
'fullClassName' => $fullClassName,
|
||||
'namespaceName' => $namespaceName
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $mockClassName
|
||||
* @param boolean $isInterface
|
||||
* @return array
|
||||
*/
|
||||
protected static function generateMockClassDeclaration(array $mockClassName, $isInterface)
|
||||
{
|
||||
$buffer = 'class ';
|
||||
|
||||
if ($isInterface) {
|
||||
$buffer .= sprintf(
|
||||
"%s implements PHPUnit_Framework_MockObject_MockObject, %s%s",
|
||||
$mockClassName['className'],
|
||||
!empty($mockClassName['namespaceName']) ? $mockClassName['namespaceName'] . '\\' : '',
|
||||
$mockClassName['originalClassName']
|
||||
);
|
||||
} else {
|
||||
$buffer .= sprintf(
|
||||
"%s extends %s%s implements PHPUnit_Framework_MockObject_MockObject",
|
||||
$mockClassName['className'],
|
||||
!empty($mockClassName['namespaceName']) ? $mockClassName['namespaceName'] . '\\' : '',
|
||||
$mockClassName['originalClassName']
|
||||
);
|
||||
}
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $templateDir
|
||||
* @param ReflectionMethod $method
|
||||
* @param boolean $cloneArguments
|
||||
* @return string
|
||||
*/
|
||||
protected static function generateMockedMethodDefinitionFromExisting($templateDir, ReflectionMethod $method, $cloneArguments = TRUE)
|
||||
{
|
||||
if ($method->isPrivate()) {
|
||||
$modifier = 'private';
|
||||
}
|
||||
|
||||
else if ($method->isProtected()) {
|
||||
$modifier = 'protected';
|
||||
}
|
||||
|
||||
else {
|
||||
$modifier = 'public';
|
||||
}
|
||||
|
||||
if ($method->isStatic()) {
|
||||
$static = TRUE;
|
||||
} else {
|
||||
$static = FALSE;
|
||||
}
|
||||
|
||||
if ($method->returnsReference()) {
|
||||
$reference = '&';
|
||||
} else {
|
||||
$reference = '';
|
||||
}
|
||||
|
||||
return self::generateMockedMethodDefinition(
|
||||
$templateDir,
|
||||
$method->getDeclaringClass()->getName(),
|
||||
$method->getName(),
|
||||
$cloneArguments,
|
||||
$modifier,
|
||||
PHPUnit_Util_Class::getMethodParameters($method),
|
||||
PHPUnit_Util_Class::getMethodParameters($method, TRUE),
|
||||
$reference,
|
||||
$static
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $templateDir
|
||||
* @param string $className
|
||||
* @param string $methodName
|
||||
* @param boolean $cloneArguments
|
||||
* @param string $modifier
|
||||
* @param string $arguments_decl
|
||||
* @param string $arguments_call
|
||||
* @param string $reference
|
||||
* @param boolean $static
|
||||
* @return string
|
||||
*/
|
||||
protected static function generateMockedMethodDefinition($templateDir, $className, $methodName, $cloneArguments = TRUE, $modifier = 'public', $arguments_decl = '', $arguments_call = '', $reference = '', $static = FALSE)
|
||||
{
|
||||
if ($static) {
|
||||
$template = new Text_Template(
|
||||
$templateDir . 'mocked_static_method.tpl'
|
||||
);
|
||||
} else {
|
||||
$template = new Text_Template(
|
||||
$templateDir . 'mocked_object_method.tpl'
|
||||
);
|
||||
}
|
||||
|
||||
$template->setVar(
|
||||
array(
|
||||
'arguments_decl' => $arguments_decl,
|
||||
'arguments_call' => $arguments_call,
|
||||
'arguments_count' => !empty($arguments_call) ? count(explode(',', $arguments_call)) : 0,
|
||||
'class_name' => $className,
|
||||
'method_name' => $methodName,
|
||||
'modifier' => $modifier,
|
||||
'reference' => $reference,
|
||||
'clone_arguments' => $cloneArguments ? 'TRUE' : 'FALSE'
|
||||
)
|
||||
);
|
||||
|
||||
return $template->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionMethod $method
|
||||
* @return boolean
|
||||
*/
|
||||
protected static function canMockMethod(ReflectionMethod $method)
|
||||
{
|
||||
if ($method->isConstructor() || $method->isFinal() ||
|
||||
isset(self::$blacklistedMethodNames[$method->getName()])) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
60
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Generator/mocked_class.tpl.dist
vendored
Normal file
60
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Generator/mocked_class.tpl.dist
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
{prologue}{class_declaration}
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
{clone}{mocked_methods}
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public static function staticExpects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return self::__phpunit_getStaticInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public static function __phpunit_getStaticInvocationMocker()
|
||||
{
|
||||
if (self::$__phpunit_staticInvocationMocker === NULL) {
|
||||
self::$__phpunit_staticInvocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return self::$__phpunit_staticInvocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return self::__phpunit_getStaticInvocationMocker()->hasMatchers() ||
|
||||
$this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
self::__phpunit_getStaticInvocationMocker()->verify();
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
}
|
||||
|
||||
public function __phpunit_cleanup()
|
||||
{
|
||||
self::$__phpunit_staticInvocationMocker = NULL;
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
$this->__phpunit_id = NULL;
|
||||
}
|
||||
|
||||
public function __phpunit_setId()
|
||||
{
|
||||
$this->__phpunit_id = sprintf('%s#%s', get_class($this), self::$__phpunit_nextId++);
|
||||
}
|
||||
}{epilogue}
|
@@ -0,0 +1,5 @@
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
|
||||
{modifier} function {reference}{method_name}({arguments_decl})
|
||||
{
|
||||
$arguments = array({arguments_call});
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > {arguments_count}) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = {arguments_count}; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'{class_name}', '{method_name}', $arguments, $this, {clone_arguments}
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
|
||||
{modifier} static function {reference}{method_name}({arguments_decl})
|
||||
{
|
||||
$arguments = array({arguments_call});
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > {arguments_count}) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = {arguments_count}; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = self::__phpunit_getStaticInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Static(
|
||||
'{class_name}', '{method_name}', $arguments, {clone_arguments}
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
class {class_name}
|
||||
{
|
||||
use {trait_name};
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
parent::__clone();
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{namespace}
|
||||
|
||||
class {class_name} extends \SOAPClient
|
||||
{
|
||||
public function __construct($wsdl, array $options)
|
||||
{
|
||||
parent::__construct('{wsdl}', $options);
|
||||
}
|
||||
{methods}}
|
@@ -0,0 +1,4 @@
|
||||
|
||||
public function {method_name}({arguments})
|
||||
{
|
||||
}
|
58
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Invocation.php
vendored
Normal file
58
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Invocation.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for invocations.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Invocation
|
||||
{
|
||||
}
|
75
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Invocation/Object.php
vendored
Normal file
75
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Invocation/Object.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a non-static invocation.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Invocation_Object extends PHPUnit_Framework_MockObject_Invocation_Static
|
||||
{
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $object;
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $methodname
|
||||
* @param array $parameters
|
||||
* @param object $object
|
||||
* @param object $cloneObjects
|
||||
*/
|
||||
public function __construct($className, $methodName, array $parameters, $object, $cloneObjects = FALSE)
|
||||
{
|
||||
parent::__construct($className, $methodName, $parameters, $cloneObjects);
|
||||
$this->object = $object;
|
||||
}
|
||||
}
|
191
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Invocation/Static.php
vendored
Normal file
191
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Invocation/Static.php
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a static invocation.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Invocation_Static implements PHPUnit_Framework_MockObject_Invocation, PHPUnit_Framework_SelfDescribing
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $uncloneableExtensions = array(
|
||||
'mysqli' => TRUE,
|
||||
'SQLite' => TRUE,
|
||||
'sqlite3' => TRUE,
|
||||
'tidy' => TRUE,
|
||||
'xmlwriter' => TRUE,
|
||||
'xsl' => TRUE
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $uncloneableClasses = array(
|
||||
'Closure',
|
||||
'COMPersistHelper',
|
||||
'IteratorIterator',
|
||||
'RecursiveIteratorIterator',
|
||||
'SplFileObject',
|
||||
'PDORow',
|
||||
'ZipArchive'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $className;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $methodName;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $parameters;
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $methodname
|
||||
* @param array $parameters
|
||||
* @param boolean $cloneObjects
|
||||
*/
|
||||
public function __construct($className, $methodName, array $parameters, $cloneObjects = FALSE)
|
||||
{
|
||||
$this->className = $className;
|
||||
$this->methodName = $methodName;
|
||||
$this->parameters = $parameters;
|
||||
|
||||
if (!$cloneObjects) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->parameters as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->parameters[$key] = $this->cloneObject($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return sprintf(
|
||||
"%s::%s(%s)",
|
||||
|
||||
$this->className,
|
||||
$this->methodName,
|
||||
join(
|
||||
', ',
|
||||
array_map(
|
||||
array('PHPUnit_Util_Type', 'shortenedExport'),
|
||||
$this->parameters
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $original
|
||||
* @return object
|
||||
*/
|
||||
protected function cloneObject($original)
|
||||
{
|
||||
$cloneable = NULL;
|
||||
$object = new ReflectionObject($original);
|
||||
|
||||
// Check the blacklist before asking PHP reflection to work around
|
||||
// https://bugs.php.net/bug.php?id=53967
|
||||
if ($object->isInternal() &&
|
||||
isset(self::$uncloneableExtensions[$object->getExtensionName()])) {
|
||||
$cloneable = FALSE;
|
||||
}
|
||||
|
||||
if ($cloneable === NULL) {
|
||||
foreach (self::$uncloneableClasses as $class) {
|
||||
if ($original instanceof $class) {
|
||||
$cloneable = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($cloneable === NULL && method_exists($object, 'isCloneable')) {
|
||||
$cloneable = $object->isCloneable();
|
||||
}
|
||||
|
||||
if ($cloneable === NULL && $object->hasMethod('__clone')) {
|
||||
$method = $object->getMethod('__clone');
|
||||
$cloneable = $method->isPublic();
|
||||
}
|
||||
|
||||
if ($cloneable === NULL) {
|
||||
$cloneable = TRUE;
|
||||
}
|
||||
|
||||
if ($cloneable) {
|
||||
try {
|
||||
return clone $original;
|
||||
}
|
||||
|
||||
catch (Exception $e) {
|
||||
return $original;
|
||||
}
|
||||
} else {
|
||||
return $original;
|
||||
}
|
||||
}
|
||||
}
|
201
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/InvocationMocker.php
vendored
Normal file
201
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/InvocationMocker.php
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mocker for invocations which are sent from
|
||||
* PHPUnit_Framework_MockObject_MockObject objects.
|
||||
*
|
||||
* Keeps track of all expectations and stubs as well as registering
|
||||
* identifications for builders.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_InvocationMocker implements PHPUnit_Framework_MockObject_Stub_MatcherCollection, PHPUnit_Framework_MockObject_Invokable, PHPUnit_Framework_MockObject_Builder_Namespace
|
||||
{
|
||||
/**
|
||||
* @var PHPUnit_Framework_MockObject_Matcher_Invocation[]
|
||||
*/
|
||||
protected $matchers = array();
|
||||
|
||||
/**
|
||||
* @var PHPUnit_Framework_MockObject_Builder_Match[]
|
||||
*/
|
||||
protected $builderMap = array();
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher
|
||||
*/
|
||||
public function addMatcher(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
$this->matchers[] = $matcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since Method available since Release 1.1.0
|
||||
*/
|
||||
public function hasMatchers()
|
||||
{
|
||||
if (empty($this->matchers)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
foreach ($this->matchers as $matcher) {
|
||||
if (!$matcher instanceof PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
* @return boolean|null
|
||||
*/
|
||||
public function lookupId($id)
|
||||
{
|
||||
if (isset($this->builderMap[$id])) {
|
||||
return $this->builderMap[$id];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
* @param PHPUnit_Framework_MockObject_Builder_Match $builder
|
||||
* @throws PHPUnit_Framework_Exception
|
||||
*/
|
||||
public function registerId($id, PHPUnit_Framework_MockObject_Builder_Match $builder)
|
||||
{
|
||||
if (isset($this->builderMap[$id])) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
'Match builder with id <' . $id . '> is already registered.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->builderMap[$id] = $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return new PHPUnit_Framework_MockObject_Builder_InvocationMocker(
|
||||
$this, $matcher
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @return mixed
|
||||
*/
|
||||
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
$exception = NULL;
|
||||
$hasReturnValue = FALSE;
|
||||
|
||||
if (strtolower($invocation->methodName) == '__tostring') {
|
||||
$returnValue = '';
|
||||
} else {
|
||||
$returnValue = NULL;
|
||||
}
|
||||
|
||||
foreach ($this->matchers as $match) {
|
||||
try {
|
||||
if ($match->matches($invocation)) {
|
||||
$value = $match->invoked($invocation);
|
||||
|
||||
if (!$hasReturnValue) {
|
||||
$returnValue = $value;
|
||||
$hasReturnValue = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception $e) {
|
||||
$exception = $e;
|
||||
}
|
||||
}
|
||||
|
||||
if ($exception !== NULL) {
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
return $returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @return boolean
|
||||
*/
|
||||
public function matches(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
foreach ($this->matchers as $matcher) {
|
||||
if (!$matcher->matches($invocation)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
foreach ($this->matchers as $matcher) {
|
||||
$matcher->verify();
|
||||
}
|
||||
}
|
||||
}
|
79
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Invokable.php
vendored
Normal file
79
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Invokable.php
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for classes which can be invoked.
|
||||
*
|
||||
* The invocation will be taken from a mock object and passed to an object
|
||||
* of this class.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Invokable extends PHPUnit_Framework_MockObject_Verifiable
|
||||
{
|
||||
/**
|
||||
* Invokes the invocation object $invocation so that it can be checked for
|
||||
* expectations or matched against stubs.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* The invocation object passed from mock object.
|
||||
* @return object
|
||||
*/
|
||||
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation);
|
||||
|
||||
/**
|
||||
* Checks if the invocation matches.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* The invocation object passed from mock object.
|
||||
* @return boolean
|
||||
*/
|
||||
public function matches(PHPUnit_Framework_MockObject_Invocation $invocation);
|
||||
}
|
308
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher.php
vendored
Normal file
308
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher.php
vendored
Normal file
@@ -0,0 +1,308 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main matcher which defines a full expectation using method, parameter and
|
||||
* invocation matchers.
|
||||
* This matcher encapsulates all the other matchers and allows the builder to
|
||||
* set the specific matchers when the appropriate methods are called (once(),
|
||||
* where() etc.).
|
||||
*
|
||||
* All properties are public so that they can easily be accessed by the builder.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Matcher implements PHPUnit_Framework_MockObject_Matcher_Invocation
|
||||
{
|
||||
/**
|
||||
* @var PHPUnit_Framework_MockObject_Matcher_Invocation
|
||||
*/
|
||||
public $invocationMatcher;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $afterMatchBuilderId = NULL;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
public $afterMatchBuilderIsInvoked = FALSE;
|
||||
|
||||
/**
|
||||
* @var PHPUnit_Framework_MockObject_Matcher_MethodName
|
||||
*/
|
||||
public $methodNameMatcher = NULL;
|
||||
|
||||
/**
|
||||
* @var PHPUnit_Framework_MockObject_Matcher_Parameters
|
||||
*/
|
||||
public $parametersMatcher = NULL;
|
||||
|
||||
/**
|
||||
* @var PHPUnit_Framework_MockObject_Stub
|
||||
*/
|
||||
public $stub = NULL;
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Matcher_Invocation $invocationMatcher
|
||||
*/
|
||||
public function __construct(PHPUnit_Framework_MockObject_Matcher_Invocation $invocationMatcher)
|
||||
{
|
||||
$this->invocationMatcher = $invocationMatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
$list = array();
|
||||
|
||||
if ($this->invocationMatcher !== NULL) {
|
||||
$list[] = $this->invocationMatcher->toString();
|
||||
}
|
||||
|
||||
if ($this->methodNameMatcher !== NULL) {
|
||||
$list[] = 'where ' . $this->methodNameMatcher->toString();
|
||||
}
|
||||
|
||||
if ($this->parametersMatcher !== NULL) {
|
||||
$list[] = 'and ' . $this->parametersMatcher->toString();
|
||||
}
|
||||
|
||||
if ($this->afterMatchBuilderId !== NULL) {
|
||||
$list[] = 'after ' . $this->afterMatchBuilderId;
|
||||
}
|
||||
|
||||
if ($this->stub !== NULL) {
|
||||
$list[] = 'will ' . $this->stub->toString();
|
||||
}
|
||||
|
||||
return join(' ', $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @return mixed
|
||||
*/
|
||||
public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
if ($this->invocationMatcher === NULL) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
'No invocation matcher is set'
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->methodNameMatcher === NULL) {
|
||||
throw new PHPUnit_Framework_Exception('No method matcher is set');
|
||||
}
|
||||
|
||||
if ($this->afterMatchBuilderId !== NULL) {
|
||||
$builder = $invocation->object
|
||||
->__phpunit_getInvocationMocker()
|
||||
->lookupId($this->afterMatchBuilderId);
|
||||
|
||||
if (!$builder) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
sprintf(
|
||||
'No builder found for match builder identification <%s>',
|
||||
|
||||
$this->afterMatchBuilderId
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$matcher = $builder->getMatcher();
|
||||
|
||||
if ($matcher && $matcher->invocationMatcher->hasBeenInvoked()) {
|
||||
$this->afterMatchBuilderIsInvoked = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
$this->invocationMatcher->invoked($invocation);
|
||||
|
||||
try {
|
||||
if ( $this->parametersMatcher !== NULL &&
|
||||
!$this->parametersMatcher->matches($invocation)) {
|
||||
$this->parametersMatcher->verify();
|
||||
}
|
||||
}
|
||||
|
||||
catch (PHPUnit_Framework_ExpectationFailedException $e) {
|
||||
throw new PHPUnit_Framework_ExpectationFailedException(
|
||||
sprintf(
|
||||
"Expectation failed for %s when %s\n%s",
|
||||
|
||||
$this->methodNameMatcher->toString(),
|
||||
$this->invocationMatcher->toString(),
|
||||
$e->getMessage()
|
||||
),
|
||||
$e->getComparisonFailure()
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->stub) {
|
||||
return $this->stub->invoke($invocation);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @return boolean
|
||||
*/
|
||||
public function matches(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
if ($this->afterMatchBuilderId !== NULL) {
|
||||
$builder = $invocation->object
|
||||
->__phpunit_getInvocationMocker()
|
||||
->lookupId($this->afterMatchBuilderId);
|
||||
|
||||
if (!$builder) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
sprintf(
|
||||
'No builder found for match builder identification <%s>',
|
||||
|
||||
$this->afterMatchBuilderId
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$matcher = $builder->getMatcher();
|
||||
|
||||
if (!$matcher) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!$matcher->invocationMatcher->hasBeenInvoked()) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->invocationMatcher === NULL) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
'No invocation matcher is set'
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->methodNameMatcher === NULL) {
|
||||
throw new PHPUnit_Framework_Exception('No method matcher is set');
|
||||
}
|
||||
|
||||
if (!$this->invocationMatcher->matches($invocation)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!$this->methodNameMatcher->matches($invocation)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
catch (PHPUnit_Framework_ExpectationFailedException $e) {
|
||||
throw new PHPUnit_Framework_ExpectationFailedException(
|
||||
sprintf(
|
||||
"Expectation failed for %s when %s\n%s",
|
||||
|
||||
$this->methodNameMatcher->toString(),
|
||||
$this->invocationMatcher->toString(),
|
||||
$e->getMessage()
|
||||
),
|
||||
$e->getComparisonFailure()
|
||||
);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws PHPUnit_Framework_Exception
|
||||
* @throws PHPUnit_Framework_ExpectationFailedException
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
if ($this->invocationMatcher === NULL) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
'No invocation matcher is set'
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->methodNameMatcher === NULL) {
|
||||
throw new PHPUnit_Framework_Exception('No method matcher is set');
|
||||
}
|
||||
|
||||
try {
|
||||
$this->invocationMatcher->verify();
|
||||
|
||||
if ($this->parametersMatcher === NULL) {
|
||||
$this->parametersMatcher = new PHPUnit_Framework_MockObject_Matcher_AnyParameters;
|
||||
}
|
||||
|
||||
$invocationIsAny = get_class($this->invocationMatcher) === 'PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount';
|
||||
if (!$invocationIsAny) {
|
||||
$this->parametersMatcher->verify();
|
||||
}
|
||||
}
|
||||
|
||||
catch (PHPUnit_Framework_ExpectationFailedException $e) {
|
||||
throw new PHPUnit_Framework_ExpectationFailedException(
|
||||
sprintf(
|
||||
"Expectation failed for %s when %s.\n%s",
|
||||
|
||||
$this->methodNameMatcher->toString(),
|
||||
$this->invocationMatcher->toString(),
|
||||
$e->getMessage()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
72
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/AnyInvokedCount.php
vendored
Normal file
72
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/AnyInvokedCount.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Invocation matcher which checks if a method has been invoked zero or more
|
||||
* times. This matcher will always match.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount extends PHPUnit_Framework_MockObject_Matcher_InvokedRecorder
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return 'invoked zero or more times';
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
}
|
||||
}
|
74
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/AnyParameters.php
vendored
Normal file
74
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/AnyParameters.php
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Invocation matcher which allos any parameters to a method.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Matcher_AnyParameters extends PHPUnit_Framework_MockObject_Matcher_StatelessInvocation
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return 'with any parameters';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @return boolean
|
||||
*/
|
||||
public function matches(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
88
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/Invocation.php
vendored
Normal file
88
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/Invocation.php
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for classes which matches an invocation based on its
|
||||
* method name, argument, order or call count.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Matcher_Invocation extends PHPUnit_Framework_SelfDescribing, PHPUnit_Framework_MockObject_Verifiable
|
||||
{
|
||||
/**
|
||||
* Registers the invocation $invocation in the object as being invoked.
|
||||
* This will only occur after matches() returns true which means the
|
||||
* current invocation is the correct one.
|
||||
*
|
||||
* The matcher can store information from the invocation which can later
|
||||
* be checked in verify(), or it can check the values directly and throw
|
||||
* and exception if an expectation is not met.
|
||||
*
|
||||
* If the matcher is a stub it will also have a return value.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* Object containing information on a mocked or stubbed method which
|
||||
* was invoked.
|
||||
* @return mixed
|
||||
*/
|
||||
public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation);
|
||||
|
||||
/**
|
||||
* Checks if the invocation $invocation matches the current rules. If it does
|
||||
* the matcher will get the invoked() method called which should check if an
|
||||
* expectation is met.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* Object containing information on a mocked or stubbed method which
|
||||
* was invoked.
|
||||
* @return bool
|
||||
*/
|
||||
public function matches(PHPUnit_Framework_MockObject_Invocation $invocation);
|
||||
}
|
127
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/InvokedAtIndex.php
vendored
Normal file
127
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/InvokedAtIndex.php
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Invocation matcher which checks if a method was invoked at a certain index.
|
||||
*
|
||||
* If the expected index number does not match the current invocation index it
|
||||
* will not match which means it skips all method and parameter matching. Only
|
||||
* once the index is reached will the method and parameter start matching and
|
||||
* verifying.
|
||||
*
|
||||
* If the index is never reached it will throw an exception in index.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex implements PHPUnit_Framework_MockObject_Matcher_Invocation
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $sequenceIndex;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $currentIndex = -1;
|
||||
|
||||
/**
|
||||
* @param integer $sequenceIndex
|
||||
*/
|
||||
public function __construct($sequenceIndex)
|
||||
{
|
||||
$this->sequenceIndex = $sequenceIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return 'invoked at sequence index ' . $this->sequenceIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @return boolean
|
||||
*/
|
||||
public function matches(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
$this->currentIndex++;
|
||||
|
||||
return $this->currentIndex == $this->sequenceIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
*/
|
||||
public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that the current expectation is valid. If everything is OK the
|
||||
* code should just return, if not it must throw an exception.
|
||||
*
|
||||
* @throws PHPUnit_Framework_ExpectationFailedException
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
if ($this->currentIndex < $this->sequenceIndex) {
|
||||
throw new PHPUnit_Framework_ExpectationFailedException(
|
||||
sprintf(
|
||||
'The expected invocation at index %s was never reached.',
|
||||
|
||||
$this->sequenceIndex
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
85
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/InvokedAtLeastOnce.php
vendored
Normal file
85
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/InvokedAtLeastOnce.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Invocation matcher which checks if a method has been invoked at least one
|
||||
* time.
|
||||
*
|
||||
* If the number of invocations is 0 it will throw an exception in verify.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce extends PHPUnit_Framework_MockObject_Matcher_InvokedRecorder
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return 'invoked at least once';
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that the current expectation is valid. If everything is OK the
|
||||
* code should just return, if not it must throw an exception.
|
||||
*
|
||||
* @throws PHPUnit_Framework_ExpectationFailedException
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
$count = $this->getInvocationCount();
|
||||
|
||||
if ($count < 1) {
|
||||
throw new PHPUnit_Framework_ExpectationFailedException(
|
||||
'Expected invocation at least once but it never occured.'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
143
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/InvokedCount.php
vendored
Normal file
143
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/InvokedCount.php
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Invocation matcher which checks if a method has been invoked a certain amount
|
||||
* of times.
|
||||
* If the number of invocations exceeds the value it will immediately throw an
|
||||
* exception,
|
||||
* If the number is less it will later be checked in verify() and also throw an
|
||||
* exception.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Matcher_InvokedCount extends PHPUnit_Framework_MockObject_Matcher_InvokedRecorder
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $expectedCount;
|
||||
|
||||
/**
|
||||
* @param interger $expectedCount
|
||||
*/
|
||||
public function __construct($expectedCount)
|
||||
{
|
||||
$this->expectedCount = $expectedCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return 'invoked ' . $this->expectedCount . ' time(s)';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @throws PHPUnit_Framework_ExpectationFailedException
|
||||
*/
|
||||
public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
parent::invoked($invocation);
|
||||
|
||||
$count = $this->getInvocationCount();
|
||||
|
||||
if ($count > $this->expectedCount) {
|
||||
$message = $invocation->toString() . ' ';
|
||||
|
||||
switch ($this->expectedCount) {
|
||||
case 0: {
|
||||
$message .= 'was not expected to be called.';
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: {
|
||||
$message .= 'was not expected to be called more than once.';
|
||||
}
|
||||
break;
|
||||
|
||||
default: {
|
||||
$message .= sprintf(
|
||||
'was not expected to be called more than %d times.',
|
||||
|
||||
$this->expectedCount
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
throw new PHPUnit_Framework_ExpectationFailedException($message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that the current expectation is valid. If everything is OK the
|
||||
* code should just return, if not it must throw an exception.
|
||||
*
|
||||
* @throws PHPUnit_Framework_ExpectationFailedException
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
$count = $this->getInvocationCount();
|
||||
|
||||
if ($count !== $this->expectedCount) {
|
||||
throw new PHPUnit_Framework_ExpectationFailedException(
|
||||
sprintf(
|
||||
'Method was expected to be called %d times, ' .
|
||||
'actually called %d times.',
|
||||
|
||||
$this->expectedCount,
|
||||
$count
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
107
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/InvokedRecorder.php
vendored
Normal file
107
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/InvokedRecorder.php
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Records invocations and provides convenience methods for checking them later
|
||||
* on.
|
||||
* This abstract class can be implemented by matchers which needs to check the
|
||||
* number of times an invocation has occured.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
* @abstract
|
||||
*/
|
||||
abstract class PHPUnit_Framework_MockObject_Matcher_InvokedRecorder implements PHPUnit_Framework_MockObject_Matcher_Invocation
|
||||
{
|
||||
/**
|
||||
* @var PHPUnit_Framework_MockObject_Invocation[]
|
||||
*/
|
||||
protected $invocations = array();
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getInvocationCount()
|
||||
{
|
||||
return count($this->invocations);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Framework_MockObject_Invocation[]
|
||||
*/
|
||||
public function getInvocations()
|
||||
{
|
||||
return $this->invocations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasBeenInvoked()
|
||||
{
|
||||
return count($this->invocations) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
*/
|
||||
public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
$this->invocations[] = $invocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @return boolean
|
||||
*/
|
||||
public function matches(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
102
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/MethodName.php
vendored
Normal file
102
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/MethodName.php
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Invocation matcher which looks for a specific method name in the invocations.
|
||||
*
|
||||
* Checks the method name all incoming invocations, the name is checked against
|
||||
* the defined constraint $constraint. If the constraint is met it will return
|
||||
* true in matches().
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Matcher_MethodName extends PHPUnit_Framework_MockObject_Matcher_StatelessInvocation
|
||||
{
|
||||
/**
|
||||
* @var PHPUnit_Framework_Constraint
|
||||
*/
|
||||
protected $constraint;
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_Constraint|string
|
||||
* @throws PHPUnit_Framework_Constraint
|
||||
*/
|
||||
public function __construct($constraint)
|
||||
{
|
||||
if (!$constraint instanceof PHPUnit_Framework_Constraint) {
|
||||
if (!is_string($constraint)) {
|
||||
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
|
||||
}
|
||||
|
||||
$constraint = new PHPUnit_Framework_Constraint_IsEqual(
|
||||
$constraint, 0, 10, FALSE, TRUE
|
||||
);
|
||||
}
|
||||
|
||||
$this->constraint = $constraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return 'method name ' . $this->constraint->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @return boolean
|
||||
*/
|
||||
public function matches(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
return $this->constraint->evaluate($invocation->methodName, '', TRUE);
|
||||
}
|
||||
}
|
160
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/Parameters.php
vendored
Normal file
160
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/Parameters.php
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Invocation matcher which looks for specific parameters in the invocations.
|
||||
*
|
||||
* Checks the parameters of all incoming invocations, the parameter list is
|
||||
* checked against the defined constraints in $parameters. If the constraint
|
||||
* is met it will return true in matches().
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Matcher_Parameters extends PHPUnit_Framework_MockObject_Matcher_StatelessInvocation
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $parameters = array();
|
||||
|
||||
/**
|
||||
* @var PHPUnit_Framework_MockObject_Invocation
|
||||
*/
|
||||
protected $invocation;
|
||||
|
||||
/**
|
||||
* @param array $parameters
|
||||
*/
|
||||
public function __construct(array $parameters)
|
||||
{
|
||||
foreach ($parameters as $parameter) {
|
||||
if (!($parameter instanceof PHPUnit_Framework_Constraint)) {
|
||||
$parameter = new PHPUnit_Framework_Constraint_IsEqual(
|
||||
$parameter
|
||||
);
|
||||
}
|
||||
|
||||
$this->parameters[] = $parameter;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
$text = 'with parameter';
|
||||
|
||||
foreach ($this->parameters as $index => $parameter) {
|
||||
if ($index > 0) {
|
||||
$text .= ' and';
|
||||
}
|
||||
|
||||
$text .= ' ' . $index . ' ' . $parameter->toString();
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* @return boolean
|
||||
*/
|
||||
public function matches(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
$this->invocation = $invocation;
|
||||
$this->verify();
|
||||
|
||||
return count($invocation->parameters) < count($this->parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the invocation $invocation matches the current rules. If it
|
||||
* does the matcher will get the invoked() method called which should check
|
||||
* if an expectation is met.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* Object containing information on a mocked or stubbed method which
|
||||
* was invoked.
|
||||
* @return bool
|
||||
* @throws PHPUnit_Framework_ExpectationFailedException
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
if ($this->invocation === NULL) {
|
||||
throw new PHPUnit_Framework_ExpectationFailedException(
|
||||
'Mocked method does not exist.'
|
||||
);
|
||||
}
|
||||
|
||||
if (count($this->invocation->parameters) < count($this->parameters)) {
|
||||
throw new PHPUnit_Framework_ExpectationFailedException(
|
||||
sprintf(
|
||||
'Parameter count for invocation %s is too low.',
|
||||
|
||||
$this->invocation->toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($this->parameters as $i => $parameter) {
|
||||
$parameter->evaluate(
|
||||
$this->invocation->parameters[$i],
|
||||
sprintf(
|
||||
'Parameter %s for invocation %s does not match expected ' .
|
||||
'value.',
|
||||
|
||||
$i,
|
||||
$this->invocation->toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
96
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/StatelessInvocation.php
vendored
Normal file
96
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher/StatelessInvocation.php
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Invocation matcher which does not care about previous state from earlier
|
||||
* invocations.
|
||||
*
|
||||
* This abstract class can be implemented by matchers which does not care about
|
||||
* state but only the current run-time value of the invocation itself.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
* @abstract
|
||||
*/
|
||||
abstract class PHPUnit_Framework_MockObject_Matcher_StatelessInvocation implements PHPUnit_Framework_MockObject_Matcher_Invocation
|
||||
{
|
||||
/**
|
||||
* Registers the invocation $invocation in the object as being invoked.
|
||||
* This will only occur after matches() returns true which means the
|
||||
* current invocation is the correct one.
|
||||
*
|
||||
* The matcher can store information from the invocation which can later
|
||||
* be checked in verify(), or it can check the values directly and throw
|
||||
* and exception if an expectation is not met.
|
||||
*
|
||||
* If the matcher is a stub it will also have a return value.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* Object containing information on a mocked or stubbed method which
|
||||
* was invoked.
|
||||
* @return mixed
|
||||
*/
|
||||
public function invoked(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the invocation $invocation matches the current rules. If it does
|
||||
* the matcher will get the invoked() method called which should check if an
|
||||
* expectation is met.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* Object containing information on a mocked or stubbed method which
|
||||
* was invoked.
|
||||
* @return bool
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
}
|
||||
}
|
291
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/MockBuilder.php
vendored
Normal file
291
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/MockBuilder.php
vendored
Normal file
@@ -0,0 +1,291 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 Giorgio Sironi <piccoloprincipeazzurro@gmail.com>
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of the Builder pattern for Mock objects.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Giorgio Sironi <piccoloprincipeazzurro@gmail.com>
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_MockBuilder
|
||||
{
|
||||
/**
|
||||
* @var PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected $testCase;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $methods = array();
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $mockClassName = '';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $constructorArgs = array();
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
protected $originalConstructor = TRUE;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
protected $originalClone = TRUE;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
protected $autoload = TRUE;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
protected $cloneArguments = FALSE;
|
||||
|
||||
/**
|
||||
* @param PHPUnit_Framework_TestCase
|
||||
* @param string
|
||||
*/
|
||||
public function __construct(PHPUnit_Framework_TestCase $testCase, $className)
|
||||
{
|
||||
$this->testCase = $testCase;
|
||||
$this->className = $className;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a mock object using a fluent interface.
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
public function getMock()
|
||||
{
|
||||
return $this->testCase->getMock(
|
||||
$this->className,
|
||||
$this->methods,
|
||||
$this->constructorArgs,
|
||||
$this->mockClassName,
|
||||
$this->originalConstructor,
|
||||
$this->originalClone,
|
||||
$this->autoload,
|
||||
$this->cloneArguments
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a mock object for an abstract class using a fluent interface.
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
public function getMockForAbstractClass()
|
||||
{
|
||||
return $this->testCase->getMockForAbstractClass(
|
||||
$this->className,
|
||||
$this->constructorArgs,
|
||||
$this->mockClassName,
|
||||
$this->originalConstructor,
|
||||
$this->originalClone,
|
||||
$this->autoload,
|
||||
$this->methods,
|
||||
$this->cloneArguments
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the subset of methods to mock. Default is to mock all of them.
|
||||
*
|
||||
* @param array|null $methods
|
||||
* @return PHPUnit_Framework_MockObject_MockBuilder
|
||||
*/
|
||||
public function setMethods($methods)
|
||||
{
|
||||
$this->methods = $methods;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the arguments for the constructor.
|
||||
*
|
||||
* @param array $args
|
||||
* @return PHPUnit_Framework_MockObject_MockBuilder
|
||||
*/
|
||||
public function setConstructorArgs(array $args)
|
||||
{
|
||||
$this->constructorArgs = $args;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the name for the mock class.
|
||||
*
|
||||
* @param string $name
|
||||
* @return PHPUnit_Framework_MockObject_MockBuilder
|
||||
*/
|
||||
public function setMockClassName($name)
|
||||
{
|
||||
$this->mockClassName = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the invocation of the original constructor.
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_MockBuilder
|
||||
*/
|
||||
public function disableOriginalConstructor()
|
||||
{
|
||||
$this->originalConstructor = FALSE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the invocation of the original constructor.
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_MockBuilder
|
||||
* @since Method available since Release 1.2.0
|
||||
*/
|
||||
public function enableOriginalConstructor()
|
||||
{
|
||||
$this->originalConstructor = TRUE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the invocation of the original clone constructor.
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_MockBuilder
|
||||
*/
|
||||
public function disableOriginalClone()
|
||||
{
|
||||
$this->originalClone = FALSE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the invocation of the original clone constructor.
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_MockBuilder
|
||||
* @since Method available since Release 1.2.0
|
||||
*/
|
||||
public function enableOriginalClone()
|
||||
{
|
||||
$this->originalClone = TRUE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the use of class autoloading while creating the mock object.
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_MockBuilder
|
||||
*/
|
||||
public function disableAutoload()
|
||||
{
|
||||
$this->autoload = FALSE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the use of class autoloading while creating the mock object.
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_MockBuilder
|
||||
* @since Method available since Release 1.2.0
|
||||
*/
|
||||
public function enableAutoload()
|
||||
{
|
||||
$this->autoload = TRUE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the cloning of arguments passed to mocked methods.
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_MockBuilder
|
||||
* @since Method available since Release 1.2.0
|
||||
*/
|
||||
public function disableArgumentCloning()
|
||||
{
|
||||
$this->cloneArguments = FALSE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the cloning of arguments passed to mocked methods.
|
||||
*
|
||||
* @return PHPUnit_Framework_MockObject_MockBuilder
|
||||
* @since Method available since Release 1.2.0
|
||||
*/
|
||||
public function enableArgumentCloning()
|
||||
{
|
||||
$this->cloneArguments = TRUE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
94
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/MockObject.php
vendored
Normal file
94
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/MockObject.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for all mock objects which are generated by
|
||||
* PHPUnit_Framework_MockObject_Mock.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_MockObject /*extends PHPUnit_Framework_MockObject_Verifiable*/
|
||||
{
|
||||
/**
|
||||
* Registers a new expectation in the mock object and returns the match
|
||||
* object which can be infused with further details.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher);
|
||||
|
||||
/**
|
||||
* Registers a new static expectation in the mock object and returns the
|
||||
* match object which can be infused with further details.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher
|
||||
* @return PHPUnit_Framework_MockObject_Builder_InvocationMocker
|
||||
*/
|
||||
public static function staticExpects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher);
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Framework_MockObject_InvocationMocker
|
||||
*/
|
||||
public function __phpunit_getInvocationMocker();
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Framework_MockObject_InvocationMocker
|
||||
*/
|
||||
public static function __phpunit_getStaticInvocationMocker();
|
||||
|
||||
/**
|
||||
* Verifies that the current expectation is valid. If everything is OK the
|
||||
* code should just return, if not it must throw an exception.
|
||||
*
|
||||
* @throws PHPUnit_Framework_ExpectationFailedException
|
||||
*/
|
||||
public function __phpunit_verify();
|
||||
}
|
71
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub.php
vendored
Normal file
71
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object that stubs the process of a normal method for a mock object.
|
||||
*
|
||||
* The stub object will replace the code for the stubbed method and return a
|
||||
* specific value instead of the original value.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Stub extends PHPUnit_Framework_SelfDescribing
|
||||
{
|
||||
/**
|
||||
* Fakes the processing of the invocation $invocation by returning a
|
||||
* specific value.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Invocation $invocation
|
||||
* The invocation which was mocked and matched by the current method
|
||||
* and argument matchers.
|
||||
* @return mixed
|
||||
*/
|
||||
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation);
|
||||
}
|
87
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ConsecutiveCalls.php
vendored
Normal file
87
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ConsecutiveCalls.php
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 Patrick Müller <elias0@gmx.net>
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stubs a method by returning a user-defined stack of values.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Patrick Müller <elias0@gmx.net>
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls implements PHPUnit_Framework_MockObject_Stub
|
||||
{
|
||||
protected $stack;
|
||||
protected $value;
|
||||
|
||||
public function __construct($stack)
|
||||
{
|
||||
$this->stack = $stack;
|
||||
}
|
||||
|
||||
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
$this->value = array_shift($this->stack);
|
||||
|
||||
if ($this->value instanceof PHPUnit_Framework_MockObject_Stub) {
|
||||
$this->value = $this->value->invoke($invocation);
|
||||
}
|
||||
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
return sprintf(
|
||||
'return user-specified value %s',
|
||||
|
||||
PHPUnit_Util_Type::toString($this->value)
|
||||
);
|
||||
}
|
||||
}
|
80
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/Exception.php
vendored
Normal file
80
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/Exception.php
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 Oliver Schlicht <o.schlicht@bitExpert.de>
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stubs a method by raising a user-defined exception.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Oliver Schlicht <o.schlicht@bitExpert.de>
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Stub_Exception implements PHPUnit_Framework_MockObject_Stub
|
||||
{
|
||||
protected $exception;
|
||||
|
||||
public function __construct(Exception $exception)
|
||||
{
|
||||
$this->exception = $exception;
|
||||
}
|
||||
|
||||
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
throw $this->exception;
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
return sprintf(
|
||||
'raise user-specified exception %s',
|
||||
|
||||
PHPUnit_Util_Type::toString($this->exception)
|
||||
);
|
||||
}
|
||||
}
|
66
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/MatcherCollection.php
vendored
Normal file
66
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/MatcherCollection.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stubs a method by returning a user-defined value.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Stub_MatcherCollection
|
||||
{
|
||||
/**
|
||||
* Adds a new matcher to the collection which can be used as an expectation
|
||||
* or a stub.
|
||||
*
|
||||
* @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher
|
||||
* Matcher for invocations to mock objects.
|
||||
*/
|
||||
public function addMatcher(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher);
|
||||
}
|
78
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/Return.php
vendored
Normal file
78
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/Return.php
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stubs a method by returning a user-defined value.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Stub_Return implements PHPUnit_Framework_MockObject_Stub
|
||||
{
|
||||
protected $value;
|
||||
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
return sprintf(
|
||||
'return user-specified value %s',
|
||||
|
||||
PHPUnit_Util_Type::toString($this->value)
|
||||
);
|
||||
}
|
||||
}
|
78
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ReturnArgument.php
vendored
Normal file
78
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ReturnArgument.php
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stubs a method by returning an argument that was passed to the mocked method.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Stub_ReturnArgument extends PHPUnit_Framework_MockObject_Stub_Return
|
||||
{
|
||||
protected $argumentIndex;
|
||||
|
||||
public function __construct($argumentIndex)
|
||||
{
|
||||
$this->argumentIndex = $argumentIndex;
|
||||
}
|
||||
|
||||
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
if (isset($invocation->parameters[$this->argumentIndex])) {
|
||||
return $invocation->parameters[$this->argumentIndex];
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
return sprintf('return argument #%d', $this->argumentIndex);
|
||||
}
|
||||
}
|
94
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ReturnCallback.php
vendored
Normal file
94
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ReturnCallback.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Stub_ReturnCallback implements PHPUnit_Framework_MockObject_Stub
|
||||
{
|
||||
protected $callback;
|
||||
|
||||
public function __construct($callback)
|
||||
{
|
||||
$this->callback = $callback;
|
||||
}
|
||||
|
||||
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
return call_user_func_array($this->callback, $invocation->parameters);
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
if (is_array($this->callback)) {
|
||||
if (is_object($this->callback[0])) {
|
||||
$class = get_class($this->callback[0]);
|
||||
$type = '->';
|
||||
} else {
|
||||
$class = $this->callback[0];
|
||||
$type = '::';
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'return result of user defined callback %s%s%s() with the ' .
|
||||
'passed arguments',
|
||||
|
||||
$class,
|
||||
$type,
|
||||
$this->callback[1]
|
||||
);
|
||||
} else {
|
||||
return 'return result of user defined callback ' . $this->callback .
|
||||
' with the passed arguments';
|
||||
}
|
||||
}
|
||||
}
|
76
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ReturnSelf.php
vendored
Normal file
76
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ReturnSelf.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
|
||||
* @copyright 2010 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stubs a method by returning the current object.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.1.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Stub_ReturnSelf implements PHPUnit_Framework_MockObject_Stub
|
||||
{
|
||||
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
if (!$invocation instanceof PHPUnit_Framework_MockObject_Invocation_Object) {
|
||||
throw new PHPUnit_Framework_Exception(
|
||||
'The current object can only be returned when mocking an ' .
|
||||
'object, not a static class.'
|
||||
);
|
||||
}
|
||||
|
||||
return $invocation->object;
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
return 'return the current object';
|
||||
}
|
||||
}
|
87
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ReturnValueMap.php
vendored
Normal file
87
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ReturnValueMap.php
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stubs a method by returning a value from a map.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Class available since Release 1.1.0
|
||||
*/
|
||||
class PHPUnit_Framework_MockObject_Stub_ReturnValueMap implements PHPUnit_Framework_MockObject_Stub
|
||||
{
|
||||
protected $valueMap;
|
||||
|
||||
public function __construct(array $valueMap)
|
||||
{
|
||||
$this->valueMap = $valueMap;
|
||||
}
|
||||
|
||||
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
|
||||
{
|
||||
$parameterCount = count($invocation->parameters);
|
||||
|
||||
foreach ($this->valueMap as $map) {
|
||||
if (!is_array($map) || $parameterCount != count($map) - 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$return = array_pop($map);
|
||||
if ($invocation->parameters === $map) {
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
return 'return value from a map';
|
||||
}
|
||||
}
|
65
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Verifiable.php
vendored
Normal file
65
vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Verifiable.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2012, Sebastian Bergmann <sb@sebastian-bergmann.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 <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/phpunit-mock-objects
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for classes which must verify a given expectation.
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2010-2012 Sebastian Bergmann <sb@sebastian-bergmann.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
|
||||
* @since Interface available since Release 1.0.0
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_Verifiable
|
||||
{
|
||||
/**
|
||||
* Verifies that the current expectation is valid. If everything is OK the
|
||||
* code should just return, if not it must throw an exception.
|
||||
*
|
||||
* @throws PHPUnit_Framework_ExpectationFailedException
|
||||
*/
|
||||
public function verify();
|
||||
}
|
Reference in New Issue
Block a user