Added KH 3.3.0
This commit is contained in:
5
includes/kohana/vendor/phpunit/phpunit-mock-objects/CONTRIBUTING.md
vendored
Normal file
5
includes/kohana/vendor/phpunit/phpunit-mock-objects/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
Pull Requests for bug fixes should be made against the current release branch (1.2).
|
||||
|
||||
Pull Requests for new features should be made against master.
|
||||
|
||||
For further notes please refer to [https://github.com/sebastianbergmann/phpunit/blob/master/CONTRIBUTING.md](https://github.com/sebastianbergmann/phpunit/blob/master/CONTRIBUTING.md)
|
17
includes/kohana/vendor/phpunit/phpunit-mock-objects/ChangeLog.markdown
vendored
Normal file
17
includes/kohana/vendor/phpunit/phpunit-mock-objects/ChangeLog.markdown
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
PHPUnit_MockObject 1.2
|
||||
======================
|
||||
|
||||
This is the list of changes for the PHPUnit_MockObject 1.2 release series.
|
||||
|
||||
PHPUnit_MockObject 1.2.1
|
||||
------------------------
|
||||
|
||||
* No changes.
|
||||
|
||||
PHPUnit_MockObject 1.2.0
|
||||
------------------------
|
||||
|
||||
* Implemented #47: Make cloning of arguments passed to mocked methods optional.
|
||||
* Implemented #84: `getMockFromWsdl()` now works with namespaces.
|
||||
* Fixed #90: Mocks with a fixed class name could only be created once.
|
||||
|
33
includes/kohana/vendor/phpunit/phpunit-mock-objects/LICENSE
vendored
Normal file
33
includes/kohana/vendor/phpunit/phpunit-mock-objects/LICENSE
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
PHPUnit_MockObject
|
||||
|
||||
Copyright (c) 2002-2012, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of Sebastian Bergmann nor the names of his
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
100
includes/kohana/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Autoload.php
vendored
Normal file
100
includes/kohana/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
includes/kohana/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Autoload.php.in
vendored
Normal file
65
includes/kohana/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];
|
||||
}
|
||||
}
|
||||
);
|
@@ -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);
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
@@ -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);
|
||||
}
|
@@ -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);
|
||||
}
|
@@ -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();
|
||||
}
|
@@ -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
includes/kohana/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Generator.php
vendored
Normal file
811
includes/kohana/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;
|
||||
}
|
||||
}
|
@@ -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
includes/kohana/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Invocation.php
vendored
Normal file
58
includes/kohana/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
|
||||
{
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -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
includes/kohana/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Invokable.php
vendored
Normal file
79
includes/kohana/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
includes/kohana/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher.php
vendored
Normal file
308
includes/kohana/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()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -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()
|
||||
{
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
@@ -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
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -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.'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -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
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -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
includes/kohana/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/MockBuilder.php
vendored
Normal file
291
includes/kohana/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
includes/kohana/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/MockObject.php
vendored
Normal file
94
includes/kohana/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
includes/kohana/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub.php
vendored
Normal file
71
includes/kohana/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);
|
||||
}
|
@@ -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)
|
||||
);
|
||||
}
|
||||
}
|
@@ -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)
|
||||
);
|
||||
}
|
||||
}
|
@@ -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
includes/kohana/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/Return.php
vendored
Normal file
78
includes/kohana/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)
|
||||
);
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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';
|
||||
}
|
||||
}
|
||||
}
|
@@ -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';
|
||||
}
|
||||
}
|
@@ -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
includes/kohana/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Verifiable.php
vendored
Normal file
65
includes/kohana/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();
|
||||
}
|
89
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/GeneratorTest.php
vendored
Normal file
89
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/GeneratorTest.php
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMock
|
||||
* @expectedException PHPUnit_Framework_Exception
|
||||
*/
|
||||
public function testGetMockFailsWhenInvalidFunctionNameIsPassedInAsAFunctionToMock()
|
||||
{
|
||||
PHPUnit_Framework_MockObject_Generator::getMock('StdClass', array(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMock
|
||||
*/
|
||||
public function testGetMockCanCreateNonExistingFunctions()
|
||||
{
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::getMock('StdClass', array('testFunction'));
|
||||
$this->assertTrue(method_exists($mock, 'testFunction'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMock
|
||||
* @expectedException PHPUnit_Framework_Exception
|
||||
* @expectedExceptionMessage duplicates: "foo, foo"
|
||||
*/
|
||||
public function testGetMockGeneratorFails()
|
||||
{
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::getMock('StdClass', array('foo', 'foo'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getObject
|
||||
*/
|
||||
public function testMockObjectHasUniqueIdSoThatTwoMockObjectsOfTheSameClassAreNotEqual()
|
||||
{
|
||||
$mock1 = PHPUnit_Framework_MockObject_Generator::getMock('stdClass');
|
||||
$mock2 = PHPUnit_Framework_MockObject_Generator::getMock('stdClass');
|
||||
$this->assertNotEquals($mock1, $mock2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
|
||||
*/
|
||||
public function testGetMockForAbstractClassDoesNotFailWhenFakingInterfaces()
|
||||
{
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass('Countable');
|
||||
$this->assertTrue(method_exists($mock, 'count'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
|
||||
*/
|
||||
public function testGetMockForAbstractClassStubbingAbstractClass()
|
||||
{
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass('AbstractMockTestClass');
|
||||
$this->assertTrue(method_exists($mock, 'doSomething'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getMockForAbstractClassExpectsInvalidArgumentExceptionDataprovider
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
|
||||
* @expectedException PHPUnit_Framework_Exception
|
||||
*/
|
||||
public function testGetMockForAbstractClassExpectingInvalidArgumentException($className, $mockClassName)
|
||||
{
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass($className, array(), $mockClassName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
|
||||
* @expectedException PHPUnit_Framework_Exception
|
||||
*/
|
||||
public function testGetMockForAbstractClassAnstractClassDoesNotExist()
|
||||
{
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass('Tux');
|
||||
}
|
||||
|
||||
/**
|
||||
* Dataprovider for test "testGetMockForAbstractClassExpectingInvalidArgumentException"
|
||||
*/
|
||||
public static function getMockForAbstractClassExpectsInvalidArgumentExceptionDataprovider()
|
||||
{
|
||||
return array(
|
||||
'className not a string' => array(array(), ''),
|
||||
'mockClassName not a string' => array('Countable', new StdClass),
|
||||
);
|
||||
}
|
||||
}
|
152
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockBuilderTest.php
vendored
Normal file
152
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockBuilderTest.php
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Mockable.php';
|
||||
|
||||
/**
|
||||
* @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 Framework_MockBuilderTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testMockBuilderRequiresClassName()
|
||||
{
|
||||
$spec = $this->getMockBuilder('Mockable');
|
||||
$mock = $spec->getMock();
|
||||
$this->assertTrue($mock instanceof Mockable);
|
||||
}
|
||||
|
||||
public function testByDefaultMocksAllMethods()
|
||||
{
|
||||
$spec = $this->getMockBuilder('Mockable');
|
||||
$mock = $spec->getMock();
|
||||
$this->assertNull($mock->mockableMethod());
|
||||
$this->assertNull($mock->anotherMockableMethod());
|
||||
}
|
||||
|
||||
public function testMethodsToMockCanBeSpecified()
|
||||
{
|
||||
$spec = $this->getMockBuilder('Mockable');
|
||||
$spec->setMethods(array('mockableMethod'));
|
||||
$mock = $spec->getMock();
|
||||
$this->assertNull($mock->mockableMethod());
|
||||
$this->assertTrue($mock->anotherMockableMethod());
|
||||
}
|
||||
|
||||
public function testByDefaultDoesNotPassArgumentsToTheConstructor()
|
||||
{
|
||||
$spec = $this->getMockBuilder('Mockable');
|
||||
$mock = $spec->getMock();
|
||||
$this->assertEquals(array(NULL, NULL), $mock->constructorArgs);
|
||||
}
|
||||
|
||||
public function testMockClassNameCanBeSpecified()
|
||||
{
|
||||
$spec = $this->getMockBuilder('Mockable');
|
||||
$spec->setMockClassName('ACustomClassName');
|
||||
$mock = $spec->getMock();
|
||||
$this->assertTrue($mock instanceof ACustomClassName);
|
||||
}
|
||||
|
||||
public function testConstructorArgumentsCanBeSpecified()
|
||||
{
|
||||
$spec = $this->getMockBuilder('Mockable');
|
||||
$spec->setConstructorArgs($expected = array(23, 42));
|
||||
$mock = $spec->getMock();
|
||||
$this->assertEquals($expected, $mock->constructorArgs);
|
||||
}
|
||||
|
||||
public function testOriginalConstructorCanBeDisabled()
|
||||
{
|
||||
$spec = $this->getMockBuilder('Mockable');
|
||||
$spec->disableOriginalConstructor();
|
||||
$mock = $spec->getMock();
|
||||
$this->assertNull($mock->constructorArgs);
|
||||
}
|
||||
|
||||
public function testByDefaultOriginalCloneIsPreserved()
|
||||
{
|
||||
$spec = $this->getMockBuilder('Mockable');
|
||||
$mock = $spec->getMock();
|
||||
$cloned = clone $mock;
|
||||
$this->assertTrue($cloned->cloned);
|
||||
}
|
||||
|
||||
public function testOriginalCloneCanBeDisabled()
|
||||
{
|
||||
$spec = $this->getMockBuilder('Mockable');
|
||||
$spec->disableOriginalClone();
|
||||
$mock = $spec->getMock();
|
||||
$mock->cloned = FALSE;
|
||||
$cloned = clone $mock;
|
||||
$this->assertFalse($cloned->cloned);
|
||||
}
|
||||
|
||||
public function testCallingAutoloadCanBeDisabled()
|
||||
{
|
||||
// it is not clear to me how to test this nor the difference
|
||||
// between calling it or not
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testProvidesAFluentInterface()
|
||||
{
|
||||
$spec = $this->getMockBuilder('Mockable')
|
||||
->setMethods(array('mockableMethod'))
|
||||
->setConstructorArgs(array())
|
||||
->setMockClassName('DummyClassName')
|
||||
->disableOriginalConstructor()
|
||||
->disableOriginalClone()
|
||||
->disableAutoload();
|
||||
$this->assertTrue($spec instanceof PHPUnit_Framework_MockObject_MockBuilder);
|
||||
}
|
||||
}
|
82
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/Invocation/ObjectTest.php
vendored
Normal file
82
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/Invocation/ObjectTest.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testConstructorRequiresClassAndMethodAndParametersAndObject()
|
||||
{
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'FooClass',
|
||||
'FooMethod',
|
||||
array('an_argument'),
|
||||
new StdClass);
|
||||
}
|
||||
|
||||
public function testAllowToGetClassNameSetInConstructor()
|
||||
{
|
||||
$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'FooClass',
|
||||
'FooMethod',
|
||||
array('an_argument'),
|
||||
new StdClass);
|
||||
|
||||
$this->assertSame('FooClass', $invocation->className);
|
||||
}
|
||||
|
||||
public function testAllowToGetMethodNameSetInConstructor()
|
||||
{
|
||||
$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'FooClass',
|
||||
'FooMethod',
|
||||
array('an_argument'),
|
||||
new StdClass);
|
||||
|
||||
$this->assertSame('FooMethod', $invocation->methodName);
|
||||
}
|
||||
|
||||
public function testAllowToGetObjectSetInConstructor()
|
||||
{
|
||||
$expectedObject = new StdClass;
|
||||
|
||||
$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'FooClass',
|
||||
'FooMethod',
|
||||
array('an_argument'),
|
||||
$expectedObject);
|
||||
|
||||
$this->assertSame($expectedObject, $invocation->object);
|
||||
}
|
||||
|
||||
public function testAllowToGetMethodParametersSetInConstructor()
|
||||
{
|
||||
$expectedParameters = array(
|
||||
'foo', 5, array('a', 'b'), new StdClass, NULL, FALSE
|
||||
);
|
||||
|
||||
$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'FooClass',
|
||||
'FooMethod',
|
||||
$expectedParameters,
|
||||
new StdClass
|
||||
);
|
||||
|
||||
$this->assertSame($expectedParameters, $invocation->parameters);
|
||||
}
|
||||
|
||||
public function testConstructorAllowToSetFlagCloneObjectsInParameters()
|
||||
{
|
||||
$parameters = array(new StdClass);
|
||||
$cloneObjects = TRUE;
|
||||
|
||||
$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'FooClass',
|
||||
'FooMethod',
|
||||
$parameters,
|
||||
new StdClass,
|
||||
$cloneObjects
|
||||
);
|
||||
|
||||
$this->assertEquals($parameters, $invocation->parameters);
|
||||
$this->assertNotSame($parameters, $invocation->parameters);
|
||||
}
|
||||
}
|
||||
|
52
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/Invocation/StaticTest.php
vendored
Normal file
52
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/Invocation/StaticTest.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
class Framework_MockObject_Invocation_StaticTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testConstructorRequiresClassAndMethodAndParameters()
|
||||
{
|
||||
new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
|
||||
}
|
||||
|
||||
public function testAllowToGetClassNameSetInConstructor()
|
||||
{
|
||||
$invocation = new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
|
||||
|
||||
$this->assertSame('FooClass', $invocation->className);
|
||||
}
|
||||
|
||||
public function testAllowToGetMethodNameSetInConstructor()
|
||||
{
|
||||
$invocation = new PHPUnit_Framework_MockObject_Invocation_Static('FooClass', 'FooMethod', array('an_argument'));
|
||||
|
||||
$this->assertSame('FooMethod', $invocation->methodName);
|
||||
}
|
||||
|
||||
public function testAllowToGetMethodParametersSetInConstructor()
|
||||
{
|
||||
$expectedParameters = array(
|
||||
'foo', 5, array('a', 'b'), new StdClass, NULL, FALSE
|
||||
);
|
||||
|
||||
$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
|
||||
'FooClass', 'FooMethod', $expectedParameters
|
||||
);
|
||||
|
||||
$this->assertSame($expectedParameters, $invocation->parameters);
|
||||
}
|
||||
|
||||
public function testConstructorAllowToSetFlagCloneObjectsInParameters()
|
||||
{
|
||||
$parameters = array(new StdClass);
|
||||
$cloneObjects = TRUE;
|
||||
|
||||
$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
|
||||
'FooClass',
|
||||
'FooMethod',
|
||||
$parameters,
|
||||
$cloneObjects
|
||||
);
|
||||
|
||||
$this->assertEquals($parameters, $invocation->parameters);
|
||||
$this->assertNotSame($parameters, $invocation->parameters);
|
||||
}
|
||||
}
|
137
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/class.phpt
vendored
Normal file
137
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/class.phpt
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function bar(Foo $foo)
|
||||
{
|
||||
}
|
||||
|
||||
public function baz(Foo $foo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
public function bar(Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'bar', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function baz(Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'baz', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
@@ -0,0 +1,91 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function __clone()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
parent::__clone();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,90 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,90 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', FALSE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function __clone()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
FALSE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,90 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,95 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
interface IFoo
|
||||
{
|
||||
public function __construct($bar);
|
||||
}
|
||||
|
||||
class Foo implements IFoo
|
||||
{
|
||||
public function __construct($bar)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,95 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
interface IFoo
|
||||
{
|
||||
public function __construct($bar);
|
||||
}
|
||||
|
||||
class Foo implements IFoo
|
||||
{
|
||||
public function __construct($bar)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
116
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/class_partial.phpt
vendored
Normal file
116
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/class_partial.phpt
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array('bar'), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function bar(Foo $foo)
|
||||
{
|
||||
}
|
||||
|
||||
public function baz(Foo $foo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array('bar'),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
public function bar(Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'bar', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
110
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/interface.phpt
vendored
Normal file
110
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/interface.phpt
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
interface Foo
|
||||
{
|
||||
public function bar(Foo $foo);
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
public function bar(Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'bar', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
@@ -0,0 +1,139 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function bar(Foo $foo)
|
||||
{
|
||||
}
|
||||
|
||||
public function baz(Foo $foo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
public function bar(Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'bar', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function baz(Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'baz', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
@@ -0,0 +1,139 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public static function bar(Foo $foo)
|
||||
{
|
||||
}
|
||||
|
||||
public static function baz(Foo $foo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
public static function bar(Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = self::__phpunit_getStaticInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Static(
|
||||
'Foo', 'bar', $arguments, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function baz(Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = self::__phpunit_getStaticInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Static(
|
||||
'Foo', 'baz', $arguments, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
140
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/namespaced_class.phpt
vendored
Normal file
140
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/namespaced_class.phpt
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function bar(Foo $foo)
|
||||
{
|
||||
}
|
||||
|
||||
public function baz(Foo $foo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = \PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
public function bar(NS\Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'NS\Foo', 'bar', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function baz(NS\Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'NS\Foo', 'baz', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
@@ -0,0 +1,93 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function __clone()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = \PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
parent::__clone();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,92 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = \PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,92 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', FALSE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function __clone()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = \PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
FALSE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,92 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = \PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,97 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
interface IFoo
|
||||
{
|
||||
public function __construct($bar);
|
||||
}
|
||||
|
||||
class Foo implements IFoo
|
||||
{
|
||||
public function __construct($bar)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = \PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,97 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
interface IFoo
|
||||
{
|
||||
public function __construct($bar);
|
||||
}
|
||||
|
||||
class Foo implements IFoo
|
||||
{
|
||||
public function __construct($bar)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = \PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
118
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/namespaced_class_partial.phpt
vendored
Normal file
118
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/namespaced_class_partial.phpt
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array('bar'), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function bar(Foo $foo)
|
||||
{
|
||||
}
|
||||
|
||||
public function baz(Foo $foo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = \PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'NS\Foo',
|
||||
array('bar'),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
public function bar(NS\Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'NS\Foo', 'bar', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
112
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/namespaced_interface.phpt
vendored
Normal file
112
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/namespaced_interface.phpt
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
interface Foo
|
||||
{
|
||||
public function bar(Foo $foo);
|
||||
}
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = \PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo implements PHPUnit_Framework_MockObject_MockObject, NS\Foo
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
public function bar(NS\Foo $foo)
|
||||
{
|
||||
$arguments = array($foo);
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 1) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 1; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'NS\Foo', 'bar', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
87
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/nonexistent_class.phpt
vendored
Normal file
87
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/nonexistent_class.phpt
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class Foo
|
||||
{
|
||||
}
|
||||
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
namespace NS {
|
||||
|
||||
class Foo
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
$mock = PHPUnit_Framework_MockObject_Generator::generate(
|
||||
'\NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
namespace NS {
|
||||
|
||||
class Foo
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private static $__phpunit_staticInvocationMocker;
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_id;
|
||||
private static $__phpunit_nextId = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
$this->__phpunit_setId();
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
36
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/wsdl_class.phpt
vendored
Normal file
36
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/wsdl_class.phpt
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl('GoogleSearch.wsdl', 'GoogleSearch')
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('soap')) echo 'skip: SOAP extension is required';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
print PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl(
|
||||
dirname(dirname(__FILE__)) . '/_files/GoogleSearch.wsdl',
|
||||
'GoogleSearch'
|
||||
);
|
||||
?>
|
||||
--EXPECTF--
|
||||
class GoogleSearch extends \SOAPClient
|
||||
{
|
||||
public function __construct($wsdl, array $options)
|
||||
{
|
||||
parent::__construct('%s/GoogleSearch.wsdl', $options);
|
||||
}
|
||||
|
||||
public function doGetCachedPage($key, $url)
|
||||
{
|
||||
}
|
||||
|
||||
public function doSpellingSuggestion($key, $phrase)
|
||||
{
|
||||
}
|
||||
|
||||
public function doGoogleSearch($key, $q, $start, $maxResults, $filter, $restrict, $safeSearch, $lr, $ie, $oe)
|
||||
{
|
||||
}
|
||||
}
|
38
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/wsdl_class_namespace.phpt
vendored
Normal file
38
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/wsdl_class_namespace.phpt
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl('GoogleSearch.wsdl', 'GoogleSearch')
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('soap')) echo 'skip: SOAP extension is required';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
print PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl(
|
||||
dirname(dirname(__FILE__)) . '/_files/GoogleSearch.wsdl',
|
||||
'My\\Space\\GoogleSearch'
|
||||
);
|
||||
?>
|
||||
--EXPECTF--
|
||||
namespace My\Space;
|
||||
|
||||
class GoogleSearch extends \SOAPClient
|
||||
{
|
||||
public function __construct($wsdl, array $options)
|
||||
{
|
||||
parent::__construct('%s/GoogleSearch.wsdl', $options);
|
||||
}
|
||||
|
||||
public function doGetCachedPage($key, $url)
|
||||
{
|
||||
}
|
||||
|
||||
public function doSpellingSuggestion($key, $phrase)
|
||||
{
|
||||
}
|
||||
|
||||
public function doGoogleSearch($key, $q, $start, $maxResults, $filter, $restrict, $safeSearch, $lr, $ie, $oe)
|
||||
{
|
||||
}
|
||||
}
|
29
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/wsdl_class_partial.phpt
vendored
Normal file
29
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObject/wsdl_class_partial.phpt
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl('GoogleSearch.wsdl', 'GoogleSearch', array('doGoogleSearch'))
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('soap')) echo 'skip: SOAP extension is required';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'Text/Template.php';
|
||||
|
||||
print PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl(
|
||||
dirname(dirname(__FILE__)) . '/_files/GoogleSearch.wsdl',
|
||||
'GoogleSearch',
|
||||
array('doGoogleSearch')
|
||||
);
|
||||
?>
|
||||
--EXPECTF--
|
||||
class GoogleSearch extends \SOAPClient
|
||||
{
|
||||
public function __construct($wsdl, array $options)
|
||||
{
|
||||
parent::__construct('%s/GoogleSearch.wsdl', $options);
|
||||
}
|
||||
|
||||
public function doGoogleSearch($key, $q, $start, $maxResults, $filter, $restrict, $safeSearch, $lr, $ie, $oe)
|
||||
{
|
||||
}
|
||||
}
|
552
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObjectTest.php
vendored
Normal file
552
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/MockObjectTest.php
vendored
Normal file
@@ -0,0 +1,552 @@
|
||||
<?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://www.phpunit.de/
|
||||
* @since File available since Release 3.0.0
|
||||
*/
|
||||
|
||||
require_once 'PHPUnit/Framework/TestCase.php';
|
||||
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'AbstractMockTestClass.php';
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'AnInterface.php';
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'FunctionCallback.php';
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'MethodCallback.php';
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'PartialMockTestClass.php';
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'SomeClass.php';
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'StaticMockTestClass.php';
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @package PHPUnit_MockObject
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @author Patrick Mueller <elias0@gmx.net>
|
||||
* @author Frank Kleine <mikey@stubbles.net>
|
||||
* @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://www.phpunit.de/
|
||||
* @since Class available since Release 3.0.0
|
||||
*/
|
||||
class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testMockedMethodIsNeverCalled()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->never())
|
||||
->method('doSomething');
|
||||
}
|
||||
|
||||
public function testMockedMethodIsNotCalledWhenExpectsAnyWithParameter()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomethingElse')
|
||||
->with('someArg');
|
||||
}
|
||||
|
||||
public function testMockedMethodIsCalledAtLeastOnce()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->atLeastOnce())
|
||||
->method('doSomething');
|
||||
|
||||
$mock->doSomething();
|
||||
}
|
||||
|
||||
public function testMockedMethodIsCalledAtLeastOnce2()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->atLeastOnce())
|
||||
->method('doSomething');
|
||||
|
||||
$mock->doSomething();
|
||||
$mock->doSomething();
|
||||
}
|
||||
|
||||
public function testMockedMethodIsCalledOnce()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->once())
|
||||
->method('doSomething');
|
||||
|
||||
$mock->doSomething();
|
||||
}
|
||||
|
||||
public function testMockedMethodIsCalledOnceWithParameter()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass');
|
||||
$mock->expects($this->once())
|
||||
->method('doSomethingElse')
|
||||
->with($this->equalTo('something'));
|
||||
|
||||
$mock->doSomethingElse('something');
|
||||
}
|
||||
|
||||
public function testMockedMethodIsCalledExactly()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->exactly(2))
|
||||
->method('doSomething');
|
||||
|
||||
$mock->doSomething();
|
||||
$mock->doSomething();
|
||||
}
|
||||
|
||||
public function testStubbedException()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->will($this->throwException(new Exception));
|
||||
|
||||
try {
|
||||
$mock->doSomething();
|
||||
}
|
||||
|
||||
catch (Exception $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testStubbedReturnValue()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->will($this->returnValue('something'));
|
||||
|
||||
$this->assertEquals('something', $mock->doSomething());
|
||||
}
|
||||
|
||||
public function testStubbedReturnValueMap()
|
||||
{
|
||||
$map = array(
|
||||
array('a', 'b', 'c', 'd'),
|
||||
array('e', 'f', 'g', 'h')
|
||||
);
|
||||
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->will($this->returnValueMap($map));
|
||||
|
||||
$this->assertEquals('d', $mock->doSomething('a', 'b', 'c'));
|
||||
$this->assertEquals('h', $mock->doSomething('e', 'f', 'g'));
|
||||
$this->assertEquals(NULL, $mock->doSomething('foo', 'bar'));
|
||||
}
|
||||
|
||||
public function testFunctionCallback()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass', array('doSomething'), array(), '', FALSE);
|
||||
$mock->expects($this->once())
|
||||
->method('doSomething')
|
||||
->will($this->returnCallback('functionCallback'));
|
||||
|
||||
$this->assertEquals('pass', $mock->doSomething('foo', 'bar'));
|
||||
}
|
||||
|
||||
public function testStaticMethodCallback()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass', array('doSomething'), array(), '', FALSE);
|
||||
$mock->expects($this->once())
|
||||
->method('doSomething')
|
||||
->will($this->returnCallback(array('MethodCallback', 'staticCallback')));
|
||||
|
||||
$this->assertEquals('pass', $mock->doSomething('foo', 'bar'));
|
||||
}
|
||||
|
||||
public function testPublicMethodCallback()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass', array('doSomething'), array(), '', FALSE);
|
||||
$mock->expects($this->once())
|
||||
->method('doSomething')
|
||||
->will($this->returnCallback(array(new MethodCallback, 'nonStaticCallback')));
|
||||
|
||||
$this->assertEquals('pass', $mock->doSomething('foo', 'bar'));
|
||||
}
|
||||
|
||||
public function testMockClassOnlyGeneratedOnce()
|
||||
{
|
||||
$mock1 = $this->getMock('AnInterface');
|
||||
$mock2 = $this->getMock('AnInterface');
|
||||
|
||||
$this->assertEquals(get_class($mock1), get_class($mock2));
|
||||
}
|
||||
|
||||
public function testMockClassDifferentForPartialMocks()
|
||||
{
|
||||
$mock1 = $this->getMock('PartialMockTestClass');
|
||||
$mock2 = $this->getMock('PartialMockTestClass', array('doSomething'));
|
||||
$mock3 = $this->getMock('PartialMockTestClass', array('doSomething'));
|
||||
$mock4 = $this->getMock('PartialMockTestClass', array('doAnotherThing'));
|
||||
$mock5 = $this->getMock('PartialMockTestClass', array('doAnotherThing'));
|
||||
|
||||
$this->assertNotEquals(get_class($mock1), get_class($mock2));
|
||||
$this->assertNotEquals(get_class($mock1), get_class($mock3));
|
||||
$this->assertNotEquals(get_class($mock1), get_class($mock4));
|
||||
$this->assertNotEquals(get_class($mock1), get_class($mock5));
|
||||
$this->assertEquals(get_class($mock2), get_class($mock3));
|
||||
$this->assertNotEquals(get_class($mock2), get_class($mock4));
|
||||
$this->assertNotEquals(get_class($mock2), get_class($mock5));
|
||||
$this->assertEquals(get_class($mock4), get_class($mock5));
|
||||
}
|
||||
|
||||
public function testMockClassStoreOverrulable()
|
||||
{
|
||||
$mock1 = $this->getMock('PartialMockTestClass');
|
||||
$mock2 = $this->getMock('PartialMockTestClass', array(), array(), 'MyMockClassNameForPartialMockTestClass1');
|
||||
$mock3 = $this->getMock('PartialMockTestClass');
|
||||
$mock4 = $this->getMock('PartialMockTestClass', array('doSomething'), array(), 'AnotherMockClassNameForPartialMockTestClass');
|
||||
$mock5 = $this->getMock('PartialMockTestClass', array(), array(), 'MyMockClassNameForPartialMockTestClass2');
|
||||
|
||||
$this->assertNotEquals(get_class($mock1), get_class($mock2));
|
||||
$this->assertEquals(get_class($mock1), get_class($mock3));
|
||||
$this->assertNotEquals(get_class($mock1), get_class($mock4));
|
||||
$this->assertNotEquals(get_class($mock2), get_class($mock3));
|
||||
$this->assertNotEquals(get_class($mock2), get_class($mock4));
|
||||
$this->assertNotEquals(get_class($mock2), get_class($mock5));
|
||||
$this->assertNotEquals(get_class($mock3), get_class($mock4));
|
||||
$this->assertNotEquals(get_class($mock3), get_class($mock5));
|
||||
$this->assertNotEquals(get_class($mock4), get_class($mock5));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMock
|
||||
*/
|
||||
public function testGetMockWithFixedClassNameCanProduceTheSameMockTwice()
|
||||
{
|
||||
$mock = $this->getMockBuilder('StdClass')->setMockClassName('FixedName')->getMock();
|
||||
$mock = $this->getMockBuilder('StdClass')->setMockClassName('FixedName')->getMock();
|
||||
$this->assertInstanceOf('StdClass', $mock);
|
||||
}
|
||||
|
||||
public function testOriginalConstructorSettingConsidered()
|
||||
{
|
||||
$mock1 = $this->getMock('PartialMockTestClass');
|
||||
$mock2 = $this->getMock('PartialMockTestClass', array(), array(), '', FALSE);
|
||||
|
||||
$this->assertTrue($mock1->constructorCalled);
|
||||
$this->assertFalse($mock2->constructorCalled);
|
||||
}
|
||||
|
||||
public function testOriginalCloneSettingConsidered()
|
||||
{
|
||||
$mock1 = $this->getMock('PartialMockTestClass');
|
||||
$mock2 = $this->getMock('PartialMockTestClass', array(), array(), '', TRUE, FALSE);
|
||||
|
||||
$this->assertNotEquals(get_class($mock1), get_class($mock2));
|
||||
}
|
||||
|
||||
public function testStubbedReturnValueForStaticMethod()
|
||||
{
|
||||
$this->getMockClass(
|
||||
'StaticMockTestClass',
|
||||
array('doSomething'),
|
||||
array(),
|
||||
'StaticMockTestClassMock'
|
||||
);
|
||||
|
||||
StaticMockTestClassMock::staticExpects($this->any())
|
||||
->method('doSomething')
|
||||
->will($this->returnValue('something'));
|
||||
|
||||
$this->assertEquals(
|
||||
'something', StaticMockTestClassMock::doSomething()
|
||||
);
|
||||
}
|
||||
|
||||
public function testStubbedReturnValueForStaticMethod2()
|
||||
{
|
||||
$this->getMockClass(
|
||||
'StaticMockTestClass',
|
||||
array('doSomething'),
|
||||
array(),
|
||||
'StaticMockTestClassMock2'
|
||||
);
|
||||
|
||||
StaticMockTestClassMock2::staticExpects($this->any())
|
||||
->method('doSomething')
|
||||
->will($this->returnValue('something'));
|
||||
|
||||
$this->assertEquals(
|
||||
'something', StaticMockTestClassMock2::doSomethingElse()
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetMockForAbstractClass()
|
||||
{
|
||||
$mock = $this->getMock('AbstractMockTestClass');
|
||||
$mock->expects($this->never())
|
||||
->method('doSomething');
|
||||
}
|
||||
|
||||
public function testStaticMethodCallWithArgumentCloningEnabled()
|
||||
{
|
||||
$expectedObject = new StdClass;
|
||||
|
||||
$this->getMockClass(
|
||||
'StaticMockTestClass',
|
||||
array('doSomething'),
|
||||
array(),
|
||||
'StaticMockTestClassMock3',
|
||||
FALSE,
|
||||
TRUE,
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
$actualArguments = array();
|
||||
|
||||
StaticMockTestClassMock3::staticExpects($this->any())
|
||||
->method('doSomething')
|
||||
->will($this->returnCallback(function() use (&$actualArguments) {
|
||||
$actualArguments = func_get_args();
|
||||
}));
|
||||
|
||||
StaticMockTestClassMock3::doSomething($expectedObject);
|
||||
|
||||
$this->assertEquals(1, count($actualArguments));
|
||||
$this->assertNotSame($expectedObject, $actualArguments[0]);
|
||||
}
|
||||
|
||||
public function testStaticMethodCallWithArgumentCloningDisabled()
|
||||
{
|
||||
$expectedObject = new StdClass;
|
||||
|
||||
$this->getMockClass(
|
||||
'StaticMockTestClass',
|
||||
array('doSomething'),
|
||||
array(),
|
||||
'StaticMockTestClassMock4',
|
||||
FALSE,
|
||||
TRUE,
|
||||
TRUE,
|
||||
FALSE
|
||||
);
|
||||
|
||||
$actualArguments = array();
|
||||
|
||||
StaticMockTestClassMock4::staticExpects($this->any())
|
||||
->method('doSomething')
|
||||
->will($this->returnCallback(function() use (&$actualArguments) {
|
||||
$actualArguments = func_get_args();
|
||||
}));
|
||||
|
||||
StaticMockTestClassMock4::doSomething($expectedObject);
|
||||
|
||||
$this->assertEquals(1, count($actualArguments));
|
||||
$this->assertEquals($expectedObject, $actualArguments[0]);
|
||||
$this->assertSame($expectedObject, $actualArguments[0]);
|
||||
}
|
||||
|
||||
public function testObjectMethodCallWithArgumentCloningEnabled()
|
||||
{
|
||||
$expectedObject = new StdClass;
|
||||
|
||||
$mock = $this->getMockBuilder('SomeClass')
|
||||
->setMethods(array('doSomethingElse'))
|
||||
->enableArgumentCloning()
|
||||
->getMock();
|
||||
|
||||
$actualArguments = array();
|
||||
|
||||
$mock->expects($this->any())
|
||||
->method('doSomethingElse')
|
||||
->will($this->returnCallback(function() use (&$actualArguments) {
|
||||
$actualArguments = func_get_args();
|
||||
}));
|
||||
|
||||
$mock->doSomethingElse($expectedObject);
|
||||
|
||||
$this->assertEquals(1, count($actualArguments));
|
||||
$this->assertEquals($expectedObject, $actualArguments[0]);
|
||||
$this->assertNotSame($expectedObject, $actualArguments[0]);
|
||||
}
|
||||
|
||||
public function testObjectMethodCallWithArgumentCloningDisabled()
|
||||
{
|
||||
$expectedObject = new StdClass;
|
||||
|
||||
$mock = $this->getMockBuilder('SomeClass')
|
||||
->setMethods(array('doSomethingElse'))
|
||||
->disableArgumentCloning()
|
||||
->getMock();
|
||||
|
||||
$actualArguments = array();
|
||||
|
||||
$mock->expects($this->any())
|
||||
->method('doSomethingElse')
|
||||
->will($this->returnCallback(function() use (&$actualArguments) {
|
||||
$actualArguments = func_get_args();
|
||||
}));
|
||||
|
||||
$mock->doSomethingElse($expectedObject);
|
||||
|
||||
$this->assertEquals(1, count($actualArguments));
|
||||
$this->assertNotSame($expectedObject, $actualArguments[0]);
|
||||
}
|
||||
|
||||
public function testVerificationOfMethodNameFailsWithoutParameters()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass', array('right', 'wrong'), array(), '', TRUE, TRUE, TRUE);
|
||||
$mock->expects($this->once())
|
||||
->method('right');
|
||||
|
||||
$mock->wrong();
|
||||
try {
|
||||
$mock->__phpunit_verify();
|
||||
$this->fail('Expected exception');
|
||||
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
|
||||
$this->assertSame(
|
||||
"Expectation failed for method name is equal to <string:right> when invoked 1 time(s).\n"
|
||||
. 'Method was expected to be called 1 times, actually called 0 times.',
|
||||
$e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
$this->resetMockObjects();
|
||||
}
|
||||
|
||||
public function testVerificationOfMethodNameFailsWithParameters()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass', array('right', 'wrong'), array(), '', TRUE, TRUE, TRUE);
|
||||
$mock->expects($this->once())
|
||||
->method('right');
|
||||
|
||||
$mock->wrong();
|
||||
try {
|
||||
$mock->__phpunit_verify();
|
||||
$this->fail('Expected exception');
|
||||
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
|
||||
$this->assertSame(
|
||||
"Expectation failed for method name is equal to <string:right> when invoked 1 time(s).\n"
|
||||
. 'Method was expected to be called 1 times, actually called 0 times.',
|
||||
$e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
$this->resetMockObjects();
|
||||
}
|
||||
|
||||
public function testVerificationOfNeverFailsWithEmptyParameters()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass', array('right', 'wrong'), array(), '', TRUE, TRUE, TRUE);
|
||||
$mock->expects($this->never())
|
||||
->method('right')
|
||||
->with();
|
||||
|
||||
try {
|
||||
$mock->right();
|
||||
$this->fail('Expected exception');
|
||||
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
|
||||
$this->assertSame(
|
||||
'SomeClass::right() was not expected to be called.',
|
||||
$e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
$this->resetMockObjects();
|
||||
}
|
||||
|
||||
public function testVerificationOfNeverFailsWithAnyParameters()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass', array('right', 'wrong'), array(), '', TRUE, TRUE, TRUE);
|
||||
$mock->expects($this->never())
|
||||
->method('right')
|
||||
->withAnyParameters();
|
||||
|
||||
try {
|
||||
$mock->right();
|
||||
$this->fail('Expected exception');
|
||||
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
|
||||
$this->assertSame(
|
||||
'SomeClass::right() was not expected to be called.',
|
||||
$e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
$this->resetMockObjects();
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension soap
|
||||
*/
|
||||
public function testCreateMockFromWsdl()
|
||||
{
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_files/GoogleSearch.wsdl', 'WsdlMock');
|
||||
$this->assertStringStartsWith(
|
||||
'Mock_WsdlMock_',
|
||||
get_class($mock)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension soap
|
||||
*/
|
||||
public function testCreateNamespacedMockFromWsdl()
|
||||
{
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_files/GoogleSearch.wsdl', 'My\\Space\\WsdlMock');
|
||||
$this->assertStringStartsWith(
|
||||
'Mock_WsdlMock_',
|
||||
get_class($mock)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension soap
|
||||
*/
|
||||
public function testCreateTwoMocksOfOneWsdlFile()
|
||||
{
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_files/GoogleSearch.wsdl');
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_files/GoogleSearch.wsdl');
|
||||
}
|
||||
|
||||
private function resetMockObjects()
|
||||
{
|
||||
$refl = new ReflectionObject($this);
|
||||
$refl = $refl->getParentClass();
|
||||
$prop = $refl->getProperty('mockObjects');
|
||||
$prop->setAccessible(true);
|
||||
$prop->setValue($this, array());
|
||||
}
|
||||
}
|
5
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/AbstractMockTestClass.php
vendored
Normal file
5
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/AbstractMockTestClass.php
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
abstract class AbstractMockTestClass
|
||||
{
|
||||
abstract public function doSomething();
|
||||
}
|
5
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/AnInterface.php
vendored
Normal file
5
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/AnInterface.php
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
interface AnInterface
|
||||
{
|
||||
public function doSomething();
|
||||
}
|
9
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/FunctionCallback.php
vendored
Normal file
9
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/FunctionCallback.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
function functionCallback()
|
||||
{
|
||||
$args = func_get_args();
|
||||
|
||||
if ($args == array('foo', 'bar')) {
|
||||
return 'pass';
|
||||
}
|
||||
}
|
198
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/GoogleSearch.wsdl
vendored
Normal file
198
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/GoogleSearch.wsdl
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- WSDL description of the Google Web APIs.
|
||||
The Google Web APIs are in beta release. All interfaces are subject to
|
||||
change as we refine and extend our APIs. Please see the terms of use
|
||||
for more information. -->
|
||||
|
||||
<!-- Revision 2002-08-16 -->
|
||||
|
||||
<definitions name="GoogleSearch"
|
||||
targetNamespace="urn:GoogleSearch"
|
||||
xmlns:typens="urn:GoogleSearch"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/">
|
||||
|
||||
<!-- Types for search - result elements, directory categories -->
|
||||
|
||||
<types>
|
||||
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="urn:GoogleSearch">
|
||||
|
||||
<xsd:complexType name="GoogleSearchResult">
|
||||
<xsd:all>
|
||||
<xsd:element name="documentFiltering" type="xsd:boolean"/>
|
||||
<xsd:element name="searchComments" type="xsd:string"/>
|
||||
<xsd:element name="estimatedTotalResultsCount" type="xsd:int"/>
|
||||
<xsd:element name="estimateIsExact" type="xsd:boolean"/>
|
||||
<xsd:element name="resultElements" type="typens:ResultElementArray"/>
|
||||
<xsd:element name="searchQuery" type="xsd:string"/>
|
||||
<xsd:element name="startIndex" type="xsd:int"/>
|
||||
<xsd:element name="endIndex" type="xsd:int"/>
|
||||
<xsd:element name="searchTips" type="xsd:string"/>
|
||||
<xsd:element name="directoryCategories" type="typens:DirectoryCategoryArray"/>
|
||||
<xsd:element name="searchTime" type="xsd:double"/>
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ResultElement">
|
||||
<xsd:all>
|
||||
<xsd:element name="summary" type="xsd:string"/>
|
||||
<xsd:element name="URL" type="xsd:string"/>
|
||||
<xsd:element name="snippet" type="xsd:string"/>
|
||||
<xsd:element name="title" type="xsd:string"/>
|
||||
<xsd:element name="cachedSize" type="xsd:string"/>
|
||||
<xsd:element name="relatedInformationPresent" type="xsd:boolean"/>
|
||||
<xsd:element name="hostName" type="xsd:string"/>
|
||||
<xsd:element name="directoryCategory" type="typens:DirectoryCategory"/>
|
||||
<xsd:element name="directoryTitle" type="xsd:string"/>
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ResultElementArray">
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="soapenc:Array">
|
||||
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:ResultElement[]"/>
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="DirectoryCategoryArray">
|
||||
<xsd:complexContent>
|
||||
<xsd:restriction base="soapenc:Array">
|
||||
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:DirectoryCategory[]"/>
|
||||
</xsd:restriction>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="DirectoryCategory">
|
||||
<xsd:all>
|
||||
<xsd:element name="fullViewableName" type="xsd:string"/>
|
||||
<xsd:element name="specialEncoding" type="xsd:string"/>
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:schema>
|
||||
</types>
|
||||
|
||||
<!-- Messages for Google Web APIs - cached page, search, spelling. -->
|
||||
|
||||
<message name="doGetCachedPage">
|
||||
<part name="key" type="xsd:string"/>
|
||||
<part name="url" type="xsd:string"/>
|
||||
</message>
|
||||
|
||||
<message name="doGetCachedPageResponse">
|
||||
<part name="return" type="xsd:base64Binary"/>
|
||||
</message>
|
||||
|
||||
<message name="doSpellingSuggestion">
|
||||
<part name="key" type="xsd:string"/>
|
||||
<part name="phrase" type="xsd:string"/>
|
||||
</message>
|
||||
|
||||
<message name="doSpellingSuggestionResponse">
|
||||
<part name="return" type="xsd:string"/>
|
||||
</message>
|
||||
|
||||
<!-- note, ie and oe are ignored by server; all traffic is UTF-8. -->
|
||||
|
||||
<message name="doGoogleSearch">
|
||||
<part name="key" type="xsd:string"/>
|
||||
<part name="q" type="xsd:string"/>
|
||||
<part name="start" type="xsd:int"/>
|
||||
<part name="maxResults" type="xsd:int"/>
|
||||
<part name="filter" type="xsd:boolean"/>
|
||||
<part name="restrict" type="xsd:string"/>
|
||||
<part name="safeSearch" type="xsd:boolean"/>
|
||||
<part name="lr" type="xsd:string"/>
|
||||
<part name="ie" type="xsd:string"/>
|
||||
<part name="oe" type="xsd:string"/>
|
||||
</message>
|
||||
|
||||
<message name="doGoogleSearchResponse">
|
||||
<part name="return" type="typens:GoogleSearchResult"/>
|
||||
</message>
|
||||
|
||||
<!-- Port for Google Web APIs, "GoogleSearch" -->
|
||||
|
||||
<portType name="GoogleSearchPort">
|
||||
|
||||
<operation name="doGetCachedPage">
|
||||
<input message="typens:doGetCachedPage"/>
|
||||
<output message="typens:doGetCachedPageResponse"/>
|
||||
</operation>
|
||||
|
||||
<operation name="doSpellingSuggestion">
|
||||
<input message="typens:doSpellingSuggestion"/>
|
||||
<output message="typens:doSpellingSuggestionResponse"/>
|
||||
</operation>
|
||||
|
||||
<operation name="doGoogleSearch">
|
||||
<input message="typens:doGoogleSearch"/>
|
||||
<output message="typens:doGoogleSearchResponse"/>
|
||||
</operation>
|
||||
|
||||
</portType>
|
||||
|
||||
|
||||
<!-- Binding for Google Web APIs - RPC, SOAP over HTTP -->
|
||||
|
||||
<binding name="GoogleSearchBinding" type="typens:GoogleSearchPort">
|
||||
<soap:binding style="rpc"
|
||||
transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
|
||||
<operation name="doGetCachedPage">
|
||||
<soap:operation soapAction="urn:GoogleSearchAction"/>
|
||||
<input>
|
||||
<soap:body use="encoded"
|
||||
namespace="urn:GoogleSearch"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="encoded"
|
||||
namespace="urn:GoogleSearch"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<operation name="doSpellingSuggestion">
|
||||
<soap:operation soapAction="urn:GoogleSearchAction"/>
|
||||
<input>
|
||||
<soap:body use="encoded"
|
||||
namespace="urn:GoogleSearch"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="encoded"
|
||||
namespace="urn:GoogleSearch"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<operation name="doGoogleSearch">
|
||||
<soap:operation soapAction="urn:GoogleSearchAction"/>
|
||||
<input>
|
||||
<soap:body use="encoded"
|
||||
namespace="urn:GoogleSearch"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="encoded"
|
||||
namespace="urn:GoogleSearch"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
|
||||
<!-- Endpoint for Google Web APIs -->
|
||||
<service name="GoogleSearchService">
|
||||
<port name="GoogleSearchPort" binding="typens:GoogleSearchBinding">
|
||||
<soap:address location="http://api.google.com/search/beta2"/>
|
||||
</port>
|
||||
</service>
|
||||
|
||||
</definitions>
|
21
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/MethodCallback.php
vendored
Normal file
21
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/MethodCallback.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
class MethodCallback
|
||||
{
|
||||
public static function staticCallback()
|
||||
{
|
||||
$args = func_get_args();
|
||||
|
||||
if ($args == array('foo', 'bar')) {
|
||||
return 'pass';
|
||||
}
|
||||
}
|
||||
|
||||
public function nonStaticCallback()
|
||||
{
|
||||
$args = func_get_args();
|
||||
|
||||
if ($args == array('foo', 'bar')) {
|
||||
return 'pass';
|
||||
}
|
||||
}
|
||||
}
|
28
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/Mockable.php
vendored
Normal file
28
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/Mockable.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
class Mockable
|
||||
{
|
||||
public $constructorArgs;
|
||||
public $cloned;
|
||||
|
||||
public function __construct($arg1 = NULL, $arg2 = NULL)
|
||||
{
|
||||
$this->constructorArgs = array($arg1, $arg2);
|
||||
}
|
||||
|
||||
public function mockableMethod()
|
||||
{
|
||||
// something different from NULL
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function anotherMockableMethod()
|
||||
{
|
||||
// something different from NULL
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->cloned = TRUE;
|
||||
}
|
||||
}
|
18
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/PartialMockTestClass.php
vendored
Normal file
18
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/PartialMockTestClass.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
class PartialMockTestClass
|
||||
{
|
||||
public $constructorCalled = FALSE;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->constructorCalled = TRUE;
|
||||
}
|
||||
|
||||
public function doSomething()
|
||||
{
|
||||
}
|
||||
|
||||
public function doAnotherThing()
|
||||
{
|
||||
}
|
||||
}
|
13
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/SomeClass.php
vendored
Normal file
13
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/SomeClass.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
class SomeClass
|
||||
{
|
||||
public function doSomething($a, $b)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function doSomethingElse($c)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/StaticMockTestClass.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/phpunit-mock-objects/Tests/_files/StaticMockTestClass.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class StaticMockTestClass
|
||||
{
|
||||
public static function doSomething()
|
||||
{
|
||||
}
|
||||
|
||||
public static function doSomethingElse()
|
||||
{
|
||||
return static::doSomething();
|
||||
}
|
||||
}
|
162
includes/kohana/vendor/phpunit/phpunit-mock-objects/build.xml
vendored
Normal file
162
includes/kohana/vendor/phpunit/phpunit-mock-objects/build.xml
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project name="PHPUnit_MockObject" default="build">
|
||||
<property name="php" value="php"/>
|
||||
<property name="phpunit" value="phpunit"/>
|
||||
|
||||
<target name="build"
|
||||
depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpunit,phpcb"/>
|
||||
|
||||
<target name="build-parallel"
|
||||
depends="prepare,lint,tools-parallel,phpunit,phpcb"/>
|
||||
|
||||
<target name="tools-parallel"
|
||||
description="Run tools in parallel">
|
||||
<parallel threadCount="2">
|
||||
<sequential>
|
||||
<antcall target="pdepend"/>
|
||||
<antcall target="phpmd-ci"/>
|
||||
</sequential>
|
||||
<antcall target="phpcpd"/>
|
||||
<antcall target="phpcs-ci"/>
|
||||
<antcall target="phploc"/>
|
||||
</parallel>
|
||||
</target>
|
||||
|
||||
<target name="clean" description="Cleanup build artifacts">
|
||||
<delete dir="${basedir}/build/api"/>
|
||||
<delete dir="${basedir}/build/code-browser"/>
|
||||
<delete dir="${basedir}/build/coverage"/>
|
||||
<delete dir="${basedir}/build/logs"/>
|
||||
<delete dir="${basedir}/build/pdepend"/>
|
||||
</target>
|
||||
|
||||
<target name="prepare" depends="clean,phpab"
|
||||
description="Prepare for build">
|
||||
<mkdir dir="${basedir}/build/api"/>
|
||||
<mkdir dir="${basedir}/build/code-browser"/>
|
||||
<mkdir dir="${basedir}/build/coverage"/>
|
||||
<mkdir dir="${basedir}/build/logs"/>
|
||||
<mkdir dir="${basedir}/build/pdepend"/>
|
||||
</target>
|
||||
|
||||
<target name="phpab" description="Generate autoloader scripts">
|
||||
<exec executable="phpab">
|
||||
<arg value="--output" />
|
||||
<arg path="PHPUnit/Framework/MockObject/Autoload.php" />
|
||||
<arg value="--template" />
|
||||
<arg path="PHPUnit/Framework/MockObject/Autoload.php.in" />
|
||||
<arg value="--indent" />
|
||||
<arg value=" " />
|
||||
<arg path="PHPUnit" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="lint">
|
||||
<apply executable="${php}" failonerror="true">
|
||||
<arg value="-l" />
|
||||
|
||||
<fileset dir="${basedir}/PHPUnit">
|
||||
<include name="**/*.php" />
|
||||
<modified />
|
||||
</fileset>
|
||||
|
||||
<fileset dir="${basedir}/Tests">
|
||||
<include name="**/*.php" />
|
||||
<modified />
|
||||
</fileset>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
<target name="phploc" description="Measure project size using PHPLOC">
|
||||
<exec executable="phploc">
|
||||
<arg value="--log-csv" />
|
||||
<arg value="${basedir}/build/logs/phploc.csv" />
|
||||
<arg path="${basedir}/PHPUnit" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="pdepend"
|
||||
description="Calculate software metrics using PHP_Depend">
|
||||
<exec executable="pdepend">
|
||||
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
|
||||
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
|
||||
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
|
||||
<arg path="${basedir}/PHPUnit" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpmd"
|
||||
description="Perform project mess detection using PHPMD">
|
||||
<exec executable="phpmd">
|
||||
<arg path="${basedir}/PHPUnit" />
|
||||
<arg value="text" />
|
||||
<arg value="${basedir}/build/phpmd.xml" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpmd-ci"
|
||||
description="Perform project mess detection using PHPMD">
|
||||
<exec executable="phpmd">
|
||||
<arg path="${basedir}/PHPUnit" />
|
||||
<arg value="xml" />
|
||||
<arg value="${basedir}/build/phpmd.xml" />
|
||||
<arg value="--reportfile" />
|
||||
<arg value="${basedir}/build/logs/pmd.xml" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpcs"
|
||||
description="Find coding standard violations using PHP_CodeSniffer">
|
||||
<exec executable="phpcs">
|
||||
<arg value="--standard=${basedir}/build/PHPCS" />
|
||||
<arg value="--extensions=php" />
|
||||
<arg value="--ignore=Autoload.php" />
|
||||
<arg path="${basedir}/PHPUnit" />
|
||||
<arg path="${basedir}/Tests" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpcs-ci"
|
||||
description="Find coding standard violations using PHP_CodeSniffer">
|
||||
<exec executable="phpcs" output="/dev/null">
|
||||
<arg value="--report=checkstyle" />
|
||||
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
|
||||
<arg value="--standard=${basedir}/build/PHPCS" />
|
||||
<arg value="--extensions=php" />
|
||||
<arg value="--ignore=Autoload.php" />
|
||||
<arg path="${basedir}/PHPUnit" />
|
||||
<arg path="${basedir}/Tests" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpcpd" description="Find duplicate code using PHPCPD">
|
||||
<exec executable="phpcpd">
|
||||
<arg value="--log-pmd" />
|
||||
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
|
||||
<arg path="${basedir}/PHPUnit" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpunit" description="Run unit tests with PHPUnit">
|
||||
<condition property="phpunit_cmd" value="${php} ${phpunit}" else="${phpunit}">
|
||||
<not>
|
||||
<equals arg1="${phpunit}" arg2="phpunit" />
|
||||
</not>
|
||||
</condition>
|
||||
|
||||
<exec executable="${phpunit_cmd}" failonerror="true"/>
|
||||
</target>
|
||||
|
||||
<target name="phpcb"
|
||||
description="Aggregate tool output with PHP_CodeBrowser">
|
||||
<exec executable="phpcb">
|
||||
<arg value="--log" />
|
||||
<arg path="${basedir}/build/logs" />
|
||||
<arg value="--source" />
|
||||
<arg path="${basedir}/PHPUnit" />
|
||||
<arg value="--output" />
|
||||
<arg path="${basedir}/build/code-browser" />
|
||||
</exec>
|
||||
</target>
|
||||
</project>
|
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
class PHPCS_Sniffs_ControlStructures_ControlSignatureSniff extends PHP_CodeSniffer_Standards_AbstractPatternSniff
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(true);
|
||||
}
|
||||
|
||||
protected function getPatterns()
|
||||
{
|
||||
return array(
|
||||
'do {EOL...} while (...);EOL',
|
||||
'while (...) {EOL',
|
||||
'for (...) {EOL',
|
||||
'if (...) {EOL',
|
||||
'foreach (...) {EOL',
|
||||
'}EOLelse if (...) {EOL',
|
||||
'}EOLelse {EOL',
|
||||
'do {EOL',
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
class PHPCS_Sniffs_Whitespace_ConcatenationSpacingSniff implements PHP_CodeSniffer_Sniff
|
||||
{
|
||||
public function register()
|
||||
{
|
||||
return array(T_STRING_CONCAT);
|
||||
}
|
||||
|
||||
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
||||
{
|
||||
$tokens = $phpcsFile->getTokens();
|
||||
|
||||
if ($tokens[($stackPtr - 1)]['code'] !== T_WHITESPACE ||
|
||||
$tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) {
|
||||
|
||||
$phpcsFile->addError(
|
||||
'Concatenation operator must be surrounded by whitespace',
|
||||
$stackPtr
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
35
includes/kohana/vendor/phpunit/phpunit-mock-objects/build/PHPCS/ruleset.xml
vendored
Normal file
35
includes/kohana/vendor/phpunit/phpunit-mock-objects/build/PHPCS/ruleset.xml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="Sebastian">
|
||||
<description>Sebastian Bergmann's coding standard</description>
|
||||
|
||||
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
|
||||
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
|
||||
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
|
||||
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
|
||||
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
|
||||
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
|
||||
|
||||
<rule ref="Generic.Commenting.Todo"/>
|
||||
|
||||
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
|
||||
|
||||
<rule ref="Generic.Files.LineEndings"/>
|
||||
|
||||
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
|
||||
<rule ref="Generic.Formatting.NoSpaceAfterCast"/>
|
||||
|
||||
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
|
||||
<rule ref="PEAR.Functions.ValidDefaultValue"/>
|
||||
|
||||
<rule ref="Generic.NamingConventions.ConstructorName"/>
|
||||
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
|
||||
<rule ref="PEAR.NamingConventions.ValidClassName"/>
|
||||
|
||||
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
|
||||
<rule ref="Generic.PHP.NoSilencedErrors"/>
|
||||
<rule ref="Generic.PHP.UpperCaseConstant"/>
|
||||
|
||||
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
|
||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
|
||||
</ruleset>
|
27
includes/kohana/vendor/phpunit/phpunit-mock-objects/build/phpmd.xml
vendored
Normal file
27
includes/kohana/vendor/phpunit/phpunit-mock-objects/build/phpmd.xml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="Sebastian"
|
||||
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||
<description>Sebastian Bergmann's ruleset</description>
|
||||
|
||||
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
|
||||
<rule ref="rulesets/codesize.xml/NPathComplexity" />
|
||||
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" />
|
||||
<rule ref="rulesets/codesize.xml/ExcessiveClassLength" />
|
||||
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
|
||||
<rule ref="rulesets/codesize.xml/ExcessiveParameterList" />
|
||||
|
||||
<rule ref="rulesets/design.xml/EvalExpression" />
|
||||
<rule ref="rulesets/design.xml/ExitExpression" />
|
||||
<rule ref="rulesets/design.xml/GotoStatement" />
|
||||
|
||||
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass" />
|
||||
|
||||
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
|
||||
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" />
|
||||
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
|
||||
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
|
||||
</ruleset>
|
41
includes/kohana/vendor/phpunit/phpunit-mock-objects/composer.json
vendored
Normal file
41
includes/kohana/vendor/phpunit/phpunit-mock-objects/composer.json
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
"description": "Mock Object library for PHPUnit",
|
||||
"type": "library",
|
||||
"keywords": [
|
||||
"xunit",
|
||||
"mock"
|
||||
],
|
||||
"homepage": "http://www.phpunit.de/",
|
||||
"license": "BSD-3-Clause",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sb@sebastian-bergmann.de",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"version": "1.2.1",
|
||||
"time": "2012-10-05",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues",
|
||||
"irc": "irc://irc.freenode.net/phpunit"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"phpunit/php-text-template": ">=1.1.1@stable",
|
||||
"ext-reflection": "*",
|
||||
"ext-spl": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-soap": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"PHPUnit/"
|
||||
]
|
||||
},
|
||||
"include-path": [
|
||||
""
|
||||
]
|
||||
}
|
19
includes/kohana/vendor/phpunit/phpunit-mock-objects/package-composer.json
vendored
Normal file
19
includes/kohana/vendor/phpunit/phpunit-mock-objects/package-composer.json
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
"keywords": [ "xunit", "mock" ],
|
||||
"license": "BSD-3-Clause",
|
||||
"homepage": "http://www.phpunit.de/",
|
||||
"dependency_map": {
|
||||
"pear.phpunit.de/Text_Template": "phpunit/php-text-template"
|
||||
},
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues",
|
||||
"irc": "irc://irc.freenode.net/phpunit"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [ "PHPUnit/" ]
|
||||
},
|
||||
"include_path": [
|
||||
""
|
||||
]
|
||||
}
|
199
includes/kohana/vendor/phpunit/phpunit-mock-objects/package.xml
vendored
Normal file
199
includes/kohana/vendor/phpunit/phpunit-mock-objects/package.xml
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<package packagerversion="1.4.10" version="2.0"
|
||||
xmlns="http://pear.php.net/dtd/package-2.0"
|
||||
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
|
||||
http://pear.php.net/dtd/tasks-1.0.xsd
|
||||
http://pear.php.net/dtd/package-2.0
|
||||
http://pear.php.net/dtd/package-2.0.xsd">
|
||||
<name>PHPUnit_MockObject</name>
|
||||
<channel>pear.phpunit.de</channel>
|
||||
<summary>Mock Object library for PHPUnit</summary>
|
||||
<description>Mock Object library for PHPUnit</description>
|
||||
<lead>
|
||||
<name>Sebastian Bergmann</name>
|
||||
<user>sb</user>
|
||||
<email>sb@sebastian-bergmann.de</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2012-10-05</date>
|
||||
<version>
|
||||
<release>1.2.1</release>
|
||||
<api>1.2.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license>The BSD 3-Clause License</license>
|
||||
<notes>http://github.com/sebastianbergmann/phpunit-mock-objects/blob/master/README.markdown</notes>
|
||||
<contents>
|
||||
<dir name="/">
|
||||
<dir name="PHPUnit">
|
||||
<dir name="Framework">
|
||||
<dir name="MockObject">
|
||||
<dir name="Builder">
|
||||
<file baseinstalldir="/" name="Identity.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="InvocationMocker.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Match.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="MethodNameMatch.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Namespace.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="ParametersMatch.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Stub.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
</dir>
|
||||
<dir name="Generator">
|
||||
<file baseinstalldir="/" name="mocked_class.tpl.dist" role="php" />
|
||||
<file baseinstalldir="/" name="mocked_clone.tpl.dist" role="php" />
|
||||
<file baseinstalldir="/" name="mocked_object_method.tpl.dist" role="php" />
|
||||
<file baseinstalldir="/" name="mocked_static_method.tpl.dist" role="php" />
|
||||
<file baseinstalldir="/" name="trait_class.tpl.dist" role="php" />
|
||||
<file baseinstalldir="/" name="unmocked_clone.tpl.dist" role="php" />
|
||||
<file baseinstalldir="/" name="wsdl_class.tpl.dist" role="php" />
|
||||
<file baseinstalldir="/" name="wsdl_method.tpl.dist" role="php" />
|
||||
</dir>
|
||||
<dir name="Invocation">
|
||||
<file baseinstalldir="/" name="Object.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Static.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
</dir>
|
||||
<dir name="Matcher">
|
||||
<file baseinstalldir="/" name="AnyInvokedCount.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="AnyParameters.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Invocation.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="InvokedAtIndex.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="InvokedAtLeastOnce.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="InvokedCount.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="InvokedRecorder.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="MethodName.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Parameters.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="StatelessInvocation.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
</dir>
|
||||
<dir name="Stub">
|
||||
<file baseinstalldir="/" name="ConsecutiveCalls.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Exception.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="MatcherCollection.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Return.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="ReturnArgument.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="ReturnCallback.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="ReturnSelf.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="ReturnValueMap.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
</dir>
|
||||
<file baseinstalldir="/" name="Autoload.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Generator.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="InvocationMocker.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Invocation.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Invokable.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Matcher.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="MockBuilder.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="MockObject.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Stub.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
<file baseinstalldir="/" name="Verifiable.php" role="php">
|
||||
<tasks:replace from="@package_version@" to="version" type="package-info" />
|
||||
</file>
|
||||
</dir>
|
||||
</dir>
|
||||
</dir>
|
||||
<file baseinstalldir="/" name="ChangeLog.markdown" role="doc"/>
|
||||
<file baseinstalldir="/" name="LICENSE" role="doc"/>
|
||||
</dir>
|
||||
</contents>
|
||||
<dependencies>
|
||||
<required>
|
||||
<php>
|
||||
<min>5.3.3</min>
|
||||
</php>
|
||||
<pearinstaller>
|
||||
<min>1.9.4</min>
|
||||
</pearinstaller>
|
||||
<package>
|
||||
<name>Text_Template</name>
|
||||
<channel>pear.phpunit.de</channel>
|
||||
<min>1.1.1</min>
|
||||
</package>
|
||||
<extension>
|
||||
<name>reflection</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>spl</name>
|
||||
</extension>
|
||||
</required>
|
||||
<optional>
|
||||
<extension>
|
||||
<name>soap</name>
|
||||
</extension>
|
||||
</optional>
|
||||
</dependencies>
|
||||
<phprelease/>
|
||||
</package>
|
31
includes/kohana/vendor/phpunit/phpunit-mock-objects/phpunit.xml.dist
vendored
Normal file
31
includes/kohana/vendor/phpunit/phpunit-mock-objects/phpunit.xml.dist
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit backupGlobals="false">
|
||||
<php>
|
||||
<const name="PHPUNIT_TESTSUITE" value="true"/>
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="PHPUnit Mock Objects">
|
||||
<directory suffix="Test.php">Tests</directory>
|
||||
<directory suffix=".phpt">Tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<logging>
|
||||
<log type="coverage-html" target="build/coverage" title="PHPUnit Mock Objects"
|
||||
charset="UTF-8" yui="true" highlight="true"
|
||||
lowUpperBound="35" highLowerBound="70"/>
|
||||
<log type="coverage-clover" target="build/logs/clover.xml"/>
|
||||
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
|
||||
</logging>
|
||||
|
||||
<filter>
|
||||
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">PHPUnit</directory>
|
||||
<exclude>
|
||||
<file>PHPUnit/Framework/MockObject/Autoload.php</file>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
Reference in New Issue
Block a user