Move into nested docroot
This commit is contained in:
parent
83a0d3a149
commit
c8b70abde9
13405 changed files with 0 additions and 0 deletions
web/vendor/phpunit/phpunit-mock-objects/tests
GeneratorTest.phpMockBuilderTest.php
MockObject
232.phpt
MockObjectTest.phpProxyObjectTest.phpInvocation
Matcher
abstract_class.phptclass.phptclass_call_parent_clone.phptclass_call_parent_constructor.phptclass_dont_call_parent_clone.phptclass_dont_call_parent_constructor.phptclass_implementing_interface_call_parent_constructor.phptclass_implementing_interface_dont_call_parent_constructor.phptclass_partial.phptclass_with_method_named_method.phptclass_with_method_with_variadic_arguments.phptinterface.phptinvocation_object_clone_object.phptnamespaced_class.phptnamespaced_class_call_parent_clone.phptnamespaced_class_call_parent_constructor.phptnamespaced_class_dont_call_parent_clone.phptnamespaced_class_dont_call_parent_constructor.phptnamespaced_class_implementing_interface_call_parent_constructor.phptnamespaced_class_implementing_interface_dont_call_parent_constructor.phptnamespaced_class_partial.phptnamespaced_interface.phptnonexistent_class.phptnonexistent_class_with_namespace.phptnonexistent_class_with_namespace_starting_with_separator.phptproxy.phptscalar_type_declarations.phptwsdl_class.phptwsdl_class_namespace.phptwsdl_class_partial.phpt_fixture
AbstractMockTestClass.phpAbstractTrait.phpAnInterface.phpAnotherInterface.phpBar.phpClassThatImplementsSerializable.phpClassWithStaticMethod.phpFoo.phpFunctionCallback.phpGoogleSearch.wsdlInterfaceWithStaticMethod.phpMethodCallback.phpMethodCallbackByReference.phpMockTestInterface.phpMockable.phpPartialMockTestClass.phpSingletonClass.phpSomeClass.phpStaticMockTestClass.phpTraversableMockTestInterface.php
bootstrap.php
200
web/vendor/phpunit/phpunit-mock-objects/tests/GeneratorTest.php
vendored
Normal file
200
web/vendor/phpunit/phpunit-mock-objects/tests/GeneratorTest.php
vendored
Normal file
|
@ -0,0 +1,200 @@
|
|||
<?php
|
||||
class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PHPUnit_Framework_MockObject_Generator
|
||||
*/
|
||||
protected $generator;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMock
|
||||
* @expectedException PHPUnit_Framework_Exception
|
||||
*/
|
||||
public function testGetMockFailsWhenInvalidFunctionNameIsPassedInAsAFunctionToMock()
|
||||
{
|
||||
$this->generator->getMock('StdClass', array(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMock
|
||||
*/
|
||||
public function testGetMockCanCreateNonExistingFunctions()
|
||||
{
|
||||
$mock = $this->generator->getMock('StdClass', array('testFunction'));
|
||||
$this->assertTrue(method_exists($mock, 'testFunction'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMock
|
||||
* @expectedException PHPUnit_Framework_MockObject_RuntimeException
|
||||
* @expectedExceptionMessage duplicates: "foo, foo"
|
||||
*/
|
||||
public function testGetMockGeneratorFails()
|
||||
{
|
||||
$mock = $this->generator->getMock('StdClass', array('foo', 'foo'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
|
||||
*/
|
||||
public function testGetMockForAbstractClassDoesNotFailWhenFakingInterfaces()
|
||||
{
|
||||
$mock = $this->generator->getMockForAbstractClass('Countable');
|
||||
$this->assertTrue(method_exists($mock, 'count'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
|
||||
*/
|
||||
public function testGetMockForAbstractClassStubbingAbstractClass()
|
||||
{
|
||||
$mock = $this->generator->getMockForAbstractClass('AbstractMockTestClass');
|
||||
$this->assertTrue(method_exists($mock, 'doSomething'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
|
||||
*/
|
||||
public function testGetMockForAbstractClassWithNonExistentMethods()
|
||||
{
|
||||
$mock = $this->generator->getMockForAbstractClass(
|
||||
'AbstractMockTestClass',
|
||||
array(),
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
array('nonexistentMethod')
|
||||
);
|
||||
|
||||
$this->assertTrue(method_exists($mock, 'nonexistentMethod'));
|
||||
$this->assertTrue(method_exists($mock, 'doSomething'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
|
||||
*/
|
||||
public function testGetMockForAbstractClassShouldCreateStubsOnlyForAbstractMethodWhenNoMethodsWereInformed()
|
||||
{
|
||||
$mock = $this->generator->getMockForAbstractClass('AbstractMockTestClass');
|
||||
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->willReturn('testing');
|
||||
|
||||
$this->assertEquals('testing', $mock->doSomething());
|
||||
$this->assertEquals(1, $mock->returnAnything());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getMockForAbstractClassExpectsInvalidArgumentExceptionDataprovider
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
|
||||
* @expectedException PHPUnit_Framework_Exception
|
||||
*/
|
||||
public function testGetMockForAbstractClassExpectingInvalidArgumentException($className, $mockClassName)
|
||||
{
|
||||
$mock = $this->generator->getMockForAbstractClass($className, array(), $mockClassName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
|
||||
* @expectedException PHPUnit_Framework_MockObject_RuntimeException
|
||||
*/
|
||||
public function testGetMockForAbstractClassAbstractClassDoesNotExist()
|
||||
{
|
||||
$mock = $this->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),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForTrait
|
||||
* @requires PHP 5.4.0
|
||||
*/
|
||||
public function testGetMockForTraitWithNonExistentMethodsAndNonAbstractMethods()
|
||||
{
|
||||
$mock = $this->generator->getMockForTrait(
|
||||
'AbstractTrait',
|
||||
array(),
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
array('nonexistentMethod')
|
||||
);
|
||||
|
||||
$this->assertTrue(method_exists($mock, 'nonexistentMethod'));
|
||||
$this->assertTrue(method_exists($mock, 'doSomething'));
|
||||
$this->assertTrue($mock->mockableMethod());
|
||||
$this->assertTrue($mock->anotherMockableMethod());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHPUnit_Framework_MockObject_Generator::getMockForTrait
|
||||
* @requires PHP 5.4.0
|
||||
*/
|
||||
public function testGetMockForTraitStubbingAbstractMethod()
|
||||
{
|
||||
$mock = $this->generator->getMockForTrait('AbstractTrait');
|
||||
$this->assertTrue(method_exists($mock, 'doSomething'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 5.4.0
|
||||
*/
|
||||
public function testGetMockForSingletonWithReflectionSuccess()
|
||||
{
|
||||
// Probably, this should be moved to tests/autoload.php
|
||||
require_once __DIR__ . '/_fixture/SingletonClass.php';
|
||||
|
||||
$mock = $this->generator->getMock('SingletonClass', array('doSomething'), array(), '', false);
|
||||
$this->assertInstanceOf('SingletonClass', $mock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as "testGetMockForSingletonWithReflectionSuccess", but we expect
|
||||
* warning for PHP < 5.4.0 since PHPUnit will try to execute private __wakeup
|
||||
* on unserialize
|
||||
*/
|
||||
public function testGetMockForSingletonWithUnserializeFail()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
|
||||
$this->markTestSkipped('Only for PHP < 5.4.0');
|
||||
}
|
||||
|
||||
$this->setExpectedException('PHPUnit_Framework_MockObject_RuntimeException');
|
||||
|
||||
// Probably, this should be moved to tests/autoload.php
|
||||
require_once __DIR__ . '/_fixture/SingletonClass.php';
|
||||
|
||||
$mock = $this->generator->getMock('SingletonClass', array('doSomething'), array(), '', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* ReflectionClass::getMethods for SoapClient on PHP 5.3 produces PHP Fatal Error
|
||||
* @runInSeparateProcess
|
||||
*/
|
||||
public function testGetMockForSoapClientReflectionMethodsDuplication()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
|
||||
$this->markTestSkipped('Only for PHP < 5.4.0');
|
||||
}
|
||||
|
||||
$mock = $this->generator->getMock('SoapClient', array(), array(), '', false);
|
||||
$this->assertInstanceOf('SoapClient', $mock);
|
||||
}
|
||||
}
|
107
web/vendor/phpunit/phpunit-mock-objects/tests/MockBuilderTest.php
vendored
Normal file
107
web/vendor/phpunit/phpunit-mock-objects/tests/MockBuilderTest.php
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of the PHPUnit_MockObject package.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
}
|
129
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/232.phpt
vendored
Normal file
129
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/232.phpt
vendored
Normal file
|
@ -0,0 +1,129 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (version_compare(PHP_VERSION, '5.4.0', '<')) print 'skip: PHP >= 5.4.0 required';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
trait BaseTrait
|
||||
{
|
||||
protected function hello()
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
}
|
||||
|
||||
trait ChildTrait
|
||||
{
|
||||
use BaseTrait
|
||||
{
|
||||
hello as private hi;
|
||||
}
|
||||
|
||||
protected function hello()
|
||||
{
|
||||
return 'hi';
|
||||
}
|
||||
|
||||
protected function world()
|
||||
{
|
||||
return $this->hi();
|
||||
}
|
||||
}
|
||||
|
||||
class Foo
|
||||
{
|
||||
use ChildTrait;
|
||||
|
||||
public function speak()
|
||||
{
|
||||
return $this->world();
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function speak()
|
||||
{
|
||||
$arguments = array();
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 0) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'speak', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
||||
|
85
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/Invocation/ObjectTest.php
vendored
Normal file
85
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/Invocation/ObjectTest.php
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
54
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/Invocation/StaticTest.php
vendored
Normal file
54
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/Invocation/StaticTest.php
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
45
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/Matcher/ConsecutiveParametersTest.php
vendored
Normal file
45
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/Matcher/ConsecutiveParametersTest.php
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
class Framework_MockObject_Matcher_ConsecutiveParametersTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testIntegration()
|
||||
{
|
||||
$mock = $this->getMock('stdClass', array('foo'));
|
||||
$mock
|
||||
->expects($this->any())
|
||||
->method('foo')
|
||||
->withConsecutive(
|
||||
array('bar'),
|
||||
array(21, 42)
|
||||
);
|
||||
$mock->foo('bar');
|
||||
$mock->foo(21, 42);
|
||||
}
|
||||
|
||||
public function testIntegrationWithLessAssertionsThenMethodCalls()
|
||||
{
|
||||
$mock = $this->getMock('stdClass', array('foo'));
|
||||
$mock
|
||||
->expects($this->any())
|
||||
->method('foo')
|
||||
->withConsecutive(
|
||||
array('bar')
|
||||
);
|
||||
$mock->foo('bar');
|
||||
$mock->foo(21, 42);
|
||||
}
|
||||
|
||||
public function testIntegrationExpectingException()
|
||||
{
|
||||
$mock = $this->getMock('stdClass', array('foo'));
|
||||
$mock
|
||||
->expects($this->any())
|
||||
->method('foo')
|
||||
->withConsecutive(
|
||||
array('bar'),
|
||||
array(21, 42)
|
||||
);
|
||||
$mock->foo('bar');
|
||||
$this->setExpectedException('PHPUnit_Framework_ExpectationFailedException');
|
||||
$mock->foo('invalid');
|
||||
}
|
||||
}
|
143
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/abstract_class.phpt
vendored
Normal file
143
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/abstract_class.phpt
vendored
Normal file
|
@ -0,0 +1,143 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
abstract class Foo
|
||||
{
|
||||
public function one()
|
||||
{
|
||||
}
|
||||
|
||||
abstract public function two();
|
||||
|
||||
abstract protected function three();
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function one()
|
||||
{
|
||||
$arguments = array();
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 0) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'one', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function two()
|
||||
{
|
||||
$arguments = array();
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 0) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'two', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function three()
|
||||
{
|
||||
$arguments = array();
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 0) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'three', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
121
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class.phpt
vendored
Normal file
121
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class.phpt
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
--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 __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
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 function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
73
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_call_parent_clone.phpt
vendored
Normal file
73
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_call_parent_clone.phpt
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function __clone()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
parent::__clone();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
72
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_call_parent_constructor.phpt
vendored
Normal file
72
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_call_parent_constructor.phpt
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
72
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_dont_call_parent_clone.phpt
vendored
Normal file
72
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_dont_call_parent_clone.phpt
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', FALSE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function __clone()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
FALSE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
72
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_dont_call_parent_constructor.phpt
vendored
Normal file
72
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_dont_call_parent_constructor.phpt
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
--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 __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
--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 __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
99
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_partial.phpt
vendored
Normal file
99
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_partial.phpt
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
--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 __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array('bar'),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
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 function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
88
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_with_method_named_method.phpt
vendored
Normal file
88
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/class_with_method_named_method.phpt
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function method()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$arguments = array();
|
||||
$count = func_num_args();
|
||||
|
||||
if ($count > 0) {
|
||||
$_arguments = func_get_args();
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$arguments[] = $_arguments[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'method', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('ClassWithMethodWithVariadicArguments', array(), 'MockFoo', TRUE, TRUE)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (version_compare(PHP_VERSION, '5.6.0', '<')) print 'skip: PHP >= 5.6.0 required';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
class ClassWithMethodWithVariadicArguments
|
||||
{
|
||||
public function methodWithVariadicArguments($a, ...$parameters)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'ClassWithMethodWithVariadicArguments',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends ClassWithMethodWithVariadicArguments implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function methodWithVariadicArguments($a, ...$parameters)
|
||||
{
|
||||
$arguments = array($a);
|
||||
$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(
|
||||
'ClassWithMethodWithVariadicArguments', 'methodWithVariadicArguments', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
93
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/interface.phpt
vendored
Normal file
93
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/interface.phpt
vendored
Normal file
|
@ -0,0 +1,93 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
interface Foo
|
||||
{
|
||||
public function bar(Foo $foo);
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
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 function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
122
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/invocation_object_clone_object.phpt
vendored
Normal file
122
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/invocation_object_clone_object.phpt
vendored
Normal file
|
@ -0,0 +1,122 @@
|
|||
--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 __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
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 function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
123
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/namespaced_class.phpt
vendored
Normal file
123
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/namespaced_class.phpt
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
--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 __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new \PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
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 function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
75
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/namespaced_class_call_parent_clone.phpt
vendored
Normal file
75
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/namespaced_class_call_parent_clone.phpt
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function __clone()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new \PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
parent::__clone();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new \PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', FALSE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function __clone()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new \PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
FALSE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new \PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
--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 __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new \PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
--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 __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new \PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
101
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/namespaced_class_partial.phpt
vendored
Normal file
101
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/namespaced_class_partial.phpt
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
--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 __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new \PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'NS\Foo',
|
||||
array('bar'),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
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 function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
95
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/namespaced_interface.phpt
vendored
Normal file
95
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/namespaced_interface.phpt
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace NS;
|
||||
|
||||
interface Foo
|
||||
{
|
||||
public function bar(Foo $foo);
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new \PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'NS\Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo implements PHPUnit_Framework_MockObject_MockObject, NS\Foo
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
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 function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
70
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/nonexistent_class.phpt
vendored
Normal file
70
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/nonexistent_class.phpt
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('NonExistentClass', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'NonExistentClass',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class NonExistentClass
|
||||
{
|
||||
}
|
||||
|
||||
class MockFoo extends NonExistentClass implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
78
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/nonexistent_class_with_namespace.phpt
vendored
Normal file
78
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/nonexistent_class_with_namespace.phpt
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $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 $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $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 $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
117
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/proxy.phpt
vendored
Normal file
117
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/proxy.phpt
vendored
Normal file
|
@ -0,0 +1,117 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', NULL, 'ProxyFoo', TRUE, TRUE, TRUE, TRUE)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function bar(Foo $foo)
|
||||
{
|
||||
}
|
||||
|
||||
public function baz(Foo $foo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo', array(), 'ProxyFoo', TRUE, TRUE, TRUE, TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class ProxyFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'bar', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return call_user_func_array(array($this->__phpunit_originalObject, "bar"), $arguments);
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke(
|
||||
new PHPUnit_Framework_MockObject_Invocation_Object(
|
||||
'Foo', 'baz', $arguments, $this, TRUE
|
||||
)
|
||||
);
|
||||
|
||||
return call_user_func_array(array($this->__phpunit_originalObject, "baz"), $arguments);
|
||||
}
|
||||
|
||||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->expects($matcher);
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
99
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/scalar_type_declarations.phpt
vendored
Normal file
99
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/scalar_type_declarations.phpt
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!method_exists('ReflectionParameter', 'hasType')) print 'skip: PHP >= 7.0.0 required';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function bar(string $baz)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
$mock = $generator->generate(
|
||||
'Foo',
|
||||
array(),
|
||||
'MockFoo',
|
||||
TRUE,
|
||||
TRUE
|
||||
);
|
||||
|
||||
print $mock['code'];
|
||||
?>
|
||||
--EXPECTF--
|
||||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
|
||||
{
|
||||
private $__phpunit_invocationMocker;
|
||||
private $__phpunit_originalObject;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
|
||||
}
|
||||
|
||||
public function bar(string $baz)
|
||||
{
|
||||
$arguments = array($baz);
|
||||
$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 function method()
|
||||
{
|
||||
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
|
||||
$expects = $this->expects($any);
|
||||
return call_user_func_array(array($expects, 'method'), func_get_args());
|
||||
}
|
||||
|
||||
public function __phpunit_setOriginalObject($originalObject)
|
||||
{
|
||||
$this->__phpunit_originalObject = $originalObject;
|
||||
}
|
||||
|
||||
public function __phpunit_getInvocationMocker()
|
||||
{
|
||||
if ($this->__phpunit_invocationMocker === NULL) {
|
||||
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
|
||||
}
|
||||
|
||||
return $this->__phpunit_invocationMocker;
|
||||
}
|
||||
|
||||
public function __phpunit_hasMatchers()
|
||||
{
|
||||
return $this->__phpunit_getInvocationMocker()->hasMatchers();
|
||||
}
|
||||
|
||||
public function __phpunit_verify()
|
||||
{
|
||||
$this->__phpunit_getInvocationMocker()->verify();
|
||||
$this->__phpunit_invocationMocker = NULL;
|
||||
}
|
||||
}
|
37
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/wsdl_class.phpt
vendored
Normal file
37
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/wsdl_class.phpt
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl('GoogleSearch.wsdl', 'GoogleSearch')
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('soap')) echo 'skip: SOAP extension is required';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
print $generator->generateClassFromWsdl(
|
||||
dirname(dirname(__FILE__)) . '/_fixture/GoogleSearch.wsdl',
|
||||
'GoogleSearch'
|
||||
);
|
||||
?>
|
||||
--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)
|
||||
{
|
||||
}
|
||||
|
||||
public function doGetCachedPage($key, $url)
|
||||
{
|
||||
}
|
||||
|
||||
public function doSpellingSuggestion($key, $phrase)
|
||||
{
|
||||
}
|
||||
}
|
39
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/wsdl_class_namespace.phpt
vendored
Normal file
39
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/wsdl_class_namespace.phpt
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
--TEST--
|
||||
PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl('GoogleSearch.wsdl', 'GoogleSearch')
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('soap')) echo 'skip: SOAP extension is required';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
print $generator->generateClassFromWsdl(
|
||||
dirname(dirname(__FILE__)) . '/_fixture/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 doGoogleSearch($key, $q, $start, $maxResults, $filter, $restrict, $safeSearch, $lr, $ie, $oe)
|
||||
{
|
||||
}
|
||||
|
||||
public function doGetCachedPage($key, $url)
|
||||
{
|
||||
}
|
||||
|
||||
public function doSpellingSuggestion($key, $phrase)
|
||||
{
|
||||
}
|
||||
}
|
30
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/wsdl_class_partial.phpt
vendored
Normal file
30
web/vendor/phpunit/phpunit-mock-objects/tests/MockObject/wsdl_class_partial.phpt
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
--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 __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$generator = new PHPUnit_Framework_MockObject_Generator;
|
||||
|
||||
print $generator->generateClassFromWsdl(
|
||||
dirname(dirname(__FILE__)) . '/_fixture/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)
|
||||
{
|
||||
}
|
||||
}
|
842
web/vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php
vendored
Normal file
842
web/vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php
vendored
Normal file
|
@ -0,0 +1,842 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of the PHPUnit_MockObject package.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @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 testMockedMethodIsNeverCalledWithParameter()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass');
|
||||
$mock->expects($this->never())
|
||||
->method('doSomething')
|
||||
->with('someArg');
|
||||
}
|
||||
|
||||
public function testMockedMethodIsNotCalledWhenExpectsAnyWithParameter()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomethingElse')
|
||||
->with('someArg');
|
||||
}
|
||||
|
||||
public function testMockedMethodIsNotCalledWhenMethodSpecifiedDirectlyWithParameter()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass');
|
||||
$mock->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 testMockedMethodIsCalledAtLeastTwice()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->atLeast(2))
|
||||
->method('doSomething');
|
||||
|
||||
$mock->doSomething();
|
||||
$mock->doSomething();
|
||||
}
|
||||
|
||||
public function testMockedMethodIsCalledAtLeastTwice2()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->atLeast(2))
|
||||
->method('doSomething');
|
||||
|
||||
$mock->doSomething();
|
||||
$mock->doSomething();
|
||||
$mock->doSomething();
|
||||
}
|
||||
|
||||
public function testMockedMethodIsCalledAtMostTwice()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->atMost(2))
|
||||
->method('doSomething');
|
||||
|
||||
$mock->doSomething();
|
||||
$mock->doSomething();
|
||||
}
|
||||
|
||||
public function testMockedMethodIsCalledAtMosttTwice2()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->atMost(2))
|
||||
->method('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 testStubbedWillThrowException()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->willThrowException(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());
|
||||
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->willReturn('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'));
|
||||
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->willReturnMap($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 testStubbedReturnArgument()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->will($this->returnArgument(1));
|
||||
|
||||
$this->assertEquals('b', $mock->doSomething('a', 'b'));
|
||||
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->willReturnArgument(1);
|
||||
|
||||
$this->assertEquals('b', $mock->doSomething('a', 'b'));
|
||||
}
|
||||
|
||||
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'));
|
||||
|
||||
$mock = $this->getMock('SomeClass', array('doSomething'), array(), '', false);
|
||||
$mock->expects($this->once())
|
||||
->method('doSomething')
|
||||
->willReturnCallback('functionCallback');
|
||||
|
||||
$this->assertEquals('pass', $mock->doSomething('foo', 'bar'));
|
||||
}
|
||||
|
||||
public function testStubbedReturnSelf()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->will($this->returnSelf());
|
||||
|
||||
$this->assertEquals($mock, $mock->doSomething());
|
||||
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->willReturnSelf();
|
||||
|
||||
$this->assertEquals($mock, $mock->doSomething());
|
||||
}
|
||||
|
||||
public function testStubbedReturnOnConsecutiveCalls()
|
||||
{
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->will($this->onConsecutiveCalls('a', 'b', 'c'));
|
||||
|
||||
$this->assertEquals('a', $mock->doSomething());
|
||||
$this->assertEquals('b', $mock->doSomething());
|
||||
$this->assertEquals('c', $mock->doSomething());
|
||||
|
||||
$mock = $this->getMock('AnInterface');
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->willReturnOnConsecutiveCalls('a', 'b', 'c');
|
||||
|
||||
$this->assertEquals('a', $mock->doSomething());
|
||||
$this->assertEquals('b', $mock->doSomething());
|
||||
$this->assertEquals('c', $mock->doSomething());
|
||||
}
|
||||
|
||||
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 testGetMockForAbstractClass()
|
||||
{
|
||||
$mock = $this->getMock('AbstractMockTestClass');
|
||||
$mock->expects($this->never())
|
||||
->method('doSomething');
|
||||
}
|
||||
|
||||
public function traversableProvider()
|
||||
{
|
||||
return array(
|
||||
array('Traversable'),
|
||||
array('\Traversable'),
|
||||
array('TraversableMockTestInterface'),
|
||||
array(array('Traversable')),
|
||||
array(array('Iterator','Traversable')),
|
||||
array(array('\Iterator','\Traversable'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider traversableProvider
|
||||
*/
|
||||
public function testGetMockForTraversable($type)
|
||||
{
|
||||
$mock = $this->getMock($type);
|
||||
$this->assertInstanceOf('Traversable', $mock);
|
||||
}
|
||||
|
||||
public function testMultipleInterfacesCanBeMockedInSingleObject()
|
||||
{
|
||||
$mock = $this->getMock(array('AnInterface', 'AnotherInterface'));
|
||||
$this->assertInstanceOf('AnInterface', $mock);
|
||||
$this->assertInstanceOf('AnotherInterface', $mock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 5.4.0
|
||||
*/
|
||||
public function testGetMockForTrait()
|
||||
{
|
||||
$mock = $this->getMockForTrait('AbstractTrait');
|
||||
$mock->expects($this->never())->method('doSomething');
|
||||
|
||||
$parent = get_parent_class($mock);
|
||||
$traits = class_uses($parent, false);
|
||||
|
||||
$this->assertContains('AbstractTrait', $traits);
|
||||
}
|
||||
|
||||
public function testClonedMockObjectShouldStillEqualTheOriginal()
|
||||
{
|
||||
$a = $this->getMock('stdClass');
|
||||
$b = clone $a;
|
||||
$this->assertEquals($a, $b);
|
||||
}
|
||||
|
||||
public function testMockObjectsConstructedIndepentantlyShouldBeEqual()
|
||||
{
|
||||
$a = $this->getMock('stdClass');
|
||||
$b = $this->getMock('stdClass');
|
||||
$this->assertEquals($a, $b);
|
||||
}
|
||||
|
||||
public function testMockObjectsConstructedIndepentantlyShouldNotBeTheSame()
|
||||
{
|
||||
$a = $this->getMock('stdClass');
|
||||
$b = $this->getMock('stdClass');
|
||||
$this->assertNotSame($a, $b);
|
||||
}
|
||||
|
||||
public function testClonedMockObjectCanBeUsedInPlaceOfOriginalOne()
|
||||
{
|
||||
$x = $this->getMock('stdClass');
|
||||
$y = clone $x;
|
||||
|
||||
$mock = $this->getMock('stdClass', array('foo'));
|
||||
$mock->expects($this->once())->method('foo')->with($this->equalTo($x));
|
||||
$mock->foo($y);
|
||||
}
|
||||
|
||||
public function testClonedMockObjectIsNotIdenticalToOriginalOne()
|
||||
{
|
||||
$x = $this->getMock('stdClass');
|
||||
$y = clone $x;
|
||||
|
||||
$mock = $this->getMock('stdClass', array('foo'));
|
||||
$mock->expects($this->once())->method('foo')->with($this->logicalNot($this->identicalTo($x)));
|
||||
$mock->foo($y);
|
||||
}
|
||||
|
||||
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->assertSame($expectedObject, $actualArguments[0]);
|
||||
}
|
||||
|
||||
public function testArgumentCloningOptionGeneratesUniqueMock()
|
||||
{
|
||||
$mockWithCloning = $this->getMockBuilder('SomeClass')
|
||||
->setMethods(array('doSomethingElse'))
|
||||
->enableArgumentCloning()
|
||||
->getMock();
|
||||
|
||||
$mockWithoutCloning = $this->getMockBuilder('SomeClass')
|
||||
->setMethods(array('doSomethingElse'))
|
||||
->disableArgumentCloning()
|
||||
->getMock();
|
||||
|
||||
$this->assertNotEquals($mockWithCloning, $mockWithoutCloning);
|
||||
}
|
||||
|
||||
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.\n",
|
||||
$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.\n",
|
||||
$e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
$this->resetMockObjects();
|
||||
}
|
||||
|
||||
public function testVerificationOfMethodNameFailsWithWrongParameters()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass', array('right', 'wrong'), array(), '', true, true, true);
|
||||
$mock->expects($this->once())
|
||||
->method('right')
|
||||
->with(array('first', 'second'));
|
||||
|
||||
try {
|
||||
$mock->right(array('second'));
|
||||
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
|
||||
$this->assertSame(
|
||||
"Expectation failed for method name is equal to <string:right> when invoked 1 time(s)\n"
|
||||
. "Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.\n"
|
||||
. "Failed asserting that two arrays are equal.",
|
||||
$e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
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"
|
||||
. "Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.\n"
|
||||
. "Failed asserting that two arrays are equal.\n"
|
||||
. "--- Expected\n"
|
||||
. "+++ Actual\n"
|
||||
. "@@ @@\n"
|
||||
. " Array (\n"
|
||||
. "- 0 => 'first'\n"
|
||||
. "- 1 => 'second'\n"
|
||||
. "+ 0 => 'second'\n"
|
||||
. " )\n",
|
||||
$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();
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 199
|
||||
*/
|
||||
public function testWithAnythingInsteadOfWithAnyParameters()
|
||||
{
|
||||
$mock = $this->getMock('SomeClass', array('right'), array(), '', true, true, true);
|
||||
$mock->expects($this->once())
|
||||
->method('right')
|
||||
->with($this->anything());
|
||||
|
||||
try {
|
||||
$mock->right();
|
||||
$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" .
|
||||
"Parameter count for invocation SomeClass::right() is too low.\n" .
|
||||
"To allow 0 or more parameters with any value, omit ->with() or use ->withAnyParameters() instead.",
|
||||
$e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
$this->resetMockObjects();
|
||||
}
|
||||
|
||||
/**
|
||||
* See https://github.com/sebastianbergmann/phpunit-mock-objects/issues/81
|
||||
*/
|
||||
public function testMockArgumentsPassedByReference()
|
||||
{
|
||||
$foo = $this->getMockBuilder('MethodCallbackByReference')
|
||||
->setMethods(array('bar'))
|
||||
->disableOriginalConstructor()
|
||||
->disableArgumentCloning()
|
||||
->getMock();
|
||||
|
||||
$foo->expects($this->any())
|
||||
->method('bar')
|
||||
->will($this->returnCallback(array($foo, 'callback')));
|
||||
|
||||
$a = $b = $c = 0;
|
||||
|
||||
$foo->bar($a, $b, $c);
|
||||
|
||||
$this->assertEquals(1, $b);
|
||||
}
|
||||
|
||||
/**
|
||||
* See https://github.com/sebastianbergmann/phpunit-mock-objects/issues/81
|
||||
*/
|
||||
public function testMockArgumentsPassedByReference2()
|
||||
{
|
||||
$foo = $this->getMockBuilder('MethodCallbackByReference')
|
||||
->disableOriginalConstructor()
|
||||
->disableArgumentCloning()
|
||||
->getMock();
|
||||
|
||||
$foo->expects($this->any())
|
||||
->method('bar')
|
||||
->will($this->returnCallback(
|
||||
function (&$a, &$b, $c) {
|
||||
$b = 1;
|
||||
}
|
||||
));
|
||||
|
||||
$a = $b = $c = 0;
|
||||
|
||||
$foo->bar($a, $b, $c);
|
||||
|
||||
$this->assertEquals(1, $b);
|
||||
}
|
||||
|
||||
/**
|
||||
* https://github.com/sebastianbergmann/phpunit-mock-objects/issues/116
|
||||
*/
|
||||
public function testMockArgumentsPassedByReference3()
|
||||
{
|
||||
$foo = $this->getMockBuilder('MethodCallbackByReference')
|
||||
->setMethods(array('bar'))
|
||||
->disableOriginalConstructor()
|
||||
->disableArgumentCloning()
|
||||
->getMock();
|
||||
|
||||
$a = new stdClass();
|
||||
$b = $c = 0;
|
||||
|
||||
$foo->expects($this->any())
|
||||
->method('bar')
|
||||
->with($a, $b, $c)
|
||||
->will($this->returnCallback(array($foo, 'callback')));
|
||||
|
||||
$foo->bar($a, $b, $c);
|
||||
}
|
||||
|
||||
/**
|
||||
* https://github.com/sebastianbergmann/phpunit/issues/796
|
||||
*/
|
||||
public function testMockArgumentsPassedByReference4()
|
||||
{
|
||||
$foo = $this->getMockBuilder('MethodCallbackByReference')
|
||||
->setMethods(array('bar'))
|
||||
->disableOriginalConstructor()
|
||||
->disableArgumentCloning()
|
||||
->getMock();
|
||||
|
||||
$a = new stdClass();
|
||||
$b = $c = 0;
|
||||
|
||||
$foo->expects($this->any())
|
||||
->method('bar')
|
||||
->with($this->isInstanceOf("stdClass"), $b, $c)
|
||||
->will($this->returnCallback(array($foo, 'callback')));
|
||||
|
||||
$foo->bar($a, $b, $c);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension soap
|
||||
*/
|
||||
public function testCreateMockFromWsdl()
|
||||
{
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_fixture/GoogleSearch.wsdl', 'WsdlMock');
|
||||
$this->assertStringStartsWith(
|
||||
'Mock_WsdlMock_',
|
||||
get_class($mock)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension soap
|
||||
*/
|
||||
public function testCreateNamespacedMockFromWsdl()
|
||||
{
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_fixture/GoogleSearch.wsdl', 'My\\Space\\WsdlMock');
|
||||
$this->assertStringStartsWith(
|
||||
'Mock_WsdlMock_',
|
||||
get_class($mock)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension soap
|
||||
*/
|
||||
public function testCreateTwoMocksOfOneWsdlFile()
|
||||
{
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_fixture/GoogleSearch.wsdl');
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_fixture/GoogleSearch.wsdl');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/156
|
||||
* @ticket 156
|
||||
*/
|
||||
public function testInterfaceWithStaticMethodCanBeStubbed()
|
||||
{
|
||||
$this->assertInstanceOf(
|
||||
'InterfaceWithStaticMethod',
|
||||
$this->getMock('InterfaceWithStaticMethod')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPUnit_Framework_MockObject_BadMethodCallException
|
||||
*/
|
||||
public function testInvokingStubbedStaticMethodRaisesException()
|
||||
{
|
||||
$mock = $this->getMock('ClassWithStaticMethod');
|
||||
$mock->staticMethod();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/171
|
||||
* @ticket 171
|
||||
*/
|
||||
public function testStubForClassThatImplementsSerializableCanBeCreatedWithoutInvokingTheConstructor()
|
||||
{
|
||||
$this->assertInstanceOf(
|
||||
'ClassThatImplementsSerializable',
|
||||
$this->getMockBuilder('ClassThatImplementsSerializable')
|
||||
->disableOriginalConstructor()
|
||||
->getMock()
|
||||
);
|
||||
}
|
||||
|
||||
private function resetMockObjects()
|
||||
{
|
||||
$refl = new ReflectionObject($this);
|
||||
$refl = $refl->getParentClass();
|
||||
$prop = $refl->getProperty('mockObjects');
|
||||
$prop->setAccessible(true);
|
||||
$prop->setValue($this, array());
|
||||
}
|
||||
}
|
40
web/vendor/phpunit/phpunit-mock-objects/tests/ProxyObjectTest.php
vendored
Normal file
40
web/vendor/phpunit/phpunit-mock-objects/tests/ProxyObjectTest.php
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of the PHPUnit_MockObject package.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since Class available since Release 2.0.0
|
||||
*/
|
||||
class Framework_ProxyObjectTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testMockedMethodIsProxiedToOriginalMethod()
|
||||
{
|
||||
$proxy = $this->getMockBuilder('Bar')
|
||||
->enableProxyingToOriginalMethods()
|
||||
->getMock();
|
||||
|
||||
$proxy->expects($this->once())
|
||||
->method('doSomethingElse');
|
||||
|
||||
$foo = new Foo;
|
||||
$this->assertEquals('result', $foo->doSomething($proxy));
|
||||
}
|
||||
|
||||
public function testMockedMethodWithReferenceIsProxiedToOriginalMethod()
|
||||
{
|
||||
$proxy = $this->getMockBuilder('MethodCallbackByReference')
|
||||
->enableProxyingToOriginalMethods()
|
||||
->getMock();
|
||||
$a = $b = $c = 0;
|
||||
|
||||
$proxy->callback($a, $b, $c);
|
||||
|
||||
$this->assertEquals(1, $b);
|
||||
}
|
||||
}
|
10
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/AbstractMockTestClass.php
vendored
Normal file
10
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/AbstractMockTestClass.php
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
abstract class AbstractMockTestClass implements MockTestInterface
|
||||
{
|
||||
abstract public function doSomething();
|
||||
|
||||
public function returnAnything()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
15
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/AbstractTrait.php
vendored
Normal file
15
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/AbstractTrait.php
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
trait AbstractTrait
|
||||
{
|
||||
abstract public function doSomething();
|
||||
|
||||
public function mockableMethod()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function anotherMockableMethod()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
5
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/AnInterface.php
vendored
Normal file
5
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/AnInterface.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
interface AnInterface
|
||||
{
|
||||
public function doSomething();
|
||||
}
|
5
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/AnotherInterface.php
vendored
Normal file
5
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/AnotherInterface.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
interface AnotherInterface
|
||||
{
|
||||
public function doSomethingElse();
|
||||
}
|
8
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/Bar.php
vendored
Normal file
8
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/Bar.php
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
class Bar
|
||||
{
|
||||
public function doSomethingElse()
|
||||
{
|
||||
return 'result';
|
||||
}
|
||||
}
|
15
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/ClassThatImplementsSerializable.php
vendored
Normal file
15
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/ClassThatImplementsSerializable.php
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
class ClassThatImplementsSerializable implements Serializable
|
||||
{
|
||||
public function serialize()
|
||||
{
|
||||
return get_object_vars($this);
|
||||
}
|
||||
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
foreach (unserialize($serialized) as $key => $value) {
|
||||
$this->{$key} = $value;
|
||||
}
|
||||
}
|
||||
}
|
7
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/ClassWithStaticMethod.php
vendored
Normal file
7
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/ClassWithStaticMethod.php
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
class ClassWithStaticMethod
|
||||
{
|
||||
public static function staticMethod()
|
||||
{
|
||||
}
|
||||
}
|
8
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/Foo.php
vendored
Normal file
8
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/Foo.php
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function doSomething(Bar $bar)
|
||||
{
|
||||
return $bar->doSomethingElse();
|
||||
}
|
||||
}
|
9
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/FunctionCallback.php
vendored
Normal file
9
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/FunctionCallback.php
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
function functionCallback()
|
||||
{
|
||||
$args = func_get_args();
|
||||
|
||||
if ($args == array('foo', 'bar')) {
|
||||
return 'pass';
|
||||
}
|
||||
}
|
198
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/GoogleSearch.wsdl
vendored
Normal file
198
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/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>
|
5
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/InterfaceWithStaticMethod.php
vendored
Normal file
5
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/InterfaceWithStaticMethod.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
interface InterfaceWithStaticMethod
|
||||
{
|
||||
public static function staticMethod();
|
||||
}
|
21
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/MethodCallback.php
vendored
Normal file
21
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/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';
|
||||
}
|
||||
}
|
||||
}
|
13
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/MethodCallbackByReference.php
vendored
Normal file
13
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/MethodCallbackByReference.php
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
class MethodCallbackByReference
|
||||
{
|
||||
public function bar(&$a, &$b, $c)
|
||||
{
|
||||
Legacy::bar($a, $b, $c);
|
||||
}
|
||||
|
||||
public function callback(&$a, &$b, $c)
|
||||
{
|
||||
$b = 1;
|
||||
}
|
||||
}
|
6
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/MockTestInterface.php
vendored
Normal file
6
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/MockTestInterface.php
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
interface MockTestInterface
|
||||
{
|
||||
public function returnAnything();
|
||||
public function returnAnythingElse();
|
||||
}
|
28
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/Mockable.php
vendored
Normal file
28
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/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
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/PartialMockTestClass.php
vendored
Normal file
18
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/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()
|
||||
{
|
||||
}
|
||||
}
|
28
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/SingletonClass.php
vendored
Normal file
28
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/SingletonClass.php
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
class SingletonClass
|
||||
{
|
||||
public static function getInstance()
|
||||
{
|
||||
}
|
||||
|
||||
public function doSomething()
|
||||
{
|
||||
}
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
final private function __sleep()
|
||||
{
|
||||
}
|
||||
|
||||
final private function __wakeup()
|
||||
{
|
||||
}
|
||||
|
||||
final private function __clone()
|
||||
{
|
||||
}
|
||||
}
|
13
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/SomeClass.php
vendored
Normal file
13
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/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
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/StaticMockTestClass.php
vendored
Normal file
12
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/StaticMockTestClass.php
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
class StaticMockTestClass
|
||||
{
|
||||
public static function doSomething()
|
||||
{
|
||||
}
|
||||
|
||||
public static function doSomethingElse()
|
||||
{
|
||||
return static::doSomething();
|
||||
}
|
||||
}
|
4
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/TraversableMockTestInterface.php
vendored
Normal file
4
web/vendor/phpunit/phpunit-mock-objects/tests/_fixture/TraversableMockTestInterface.php
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
interface TraversableMockTestInterface extends Traversable
|
||||
{
|
||||
}
|
3
web/vendor/phpunit/phpunit-mock-objects/tests/bootstrap.php
vendored
Normal file
3
web/vendor/phpunit/phpunit-mock-objects/tests/bootstrap.php
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
require __DIR__ . '/_fixture/FunctionCallback.php';
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
Reference in a new issue