Add pear modules, mail and net_smtp via composer (#93)

Add pear modules, mail and net_smtp via composer, remove php 5.6 build due to phpunit 6
This commit is contained in:
Thilina Hasantha
2018-01-08 23:13:43 +01:00
committed by GitHub
parent 359e3f8382
commit e7792e7d79
2349 changed files with 117270 additions and 83170 deletions

View File

@@ -1,5 +1,16 @@
<?php
class Framework_MockObject_Builder_InvocationMockerTest extends PHPUnit_Framework_TestCase
/*
* This file is part of the phpunit-mock-objects 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.
*/
use PHPUnit\Framework\TestCase;
class InvocationMockerTest extends TestCase
{
public function testWillReturnWithOneValue()
{

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
trait BaseTrait
@@ -38,9 +38,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -53,7 +53,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -78,7 +78,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'speak', $arguments, '', $this, true
)
);
@@ -86,14 +86,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -106,7 +106,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -0,0 +1,98 @@
--TEST--
https://github.com/sebastianbergmann/phpunit-mock-objects/issues/397
--FILE--
<?php
class C
{
public function m(?self $other): self
{
}
}
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
C::class,
[],
'MockC',
true,
true
);
print $mock['code'];
--EXPECTF--
class MockC extends C implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
private $__phpunit_configurable = ['m'];
public function __clone()
{
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function m(?C $other): C
{
$arguments = array($other);
$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\ObjectInvocation(
'C', 'm', $arguments, 'C', $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($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;
}
public function __phpunit_hasMatchers()
{
return $this->__phpunit_getInvocationMocker()->hasMatchers();
}
public function __phpunit_verify($unsetInvocationMocker = true)
{
$this->__phpunit_getInvocationMocker()->verify();
if ($unsetInvocationMocker) {
$this->__phpunit_invocationMocker = null;
}
}
}

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
abstract class Foo
@@ -13,9 +13,9 @@ abstract class Foo
abstract protected function three();
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -28,7 +28,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -53,7 +53,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'one', $arguments, '', $this, true
)
);
@@ -75,7 +75,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'two', $arguments, '', $this, true
)
);
@@ -97,7 +97,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'three', $arguments, '', $this, true
)
);
@@ -105,14 +105,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -125,7 +125,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
class Foo
@@ -13,9 +13,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -28,7 +28,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -53,7 +53,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'bar', $arguments, '', $this, true
)
);
@@ -75,7 +75,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'baz', $arguments, '', $this, true
)
);
@@ -83,14 +83,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -103,7 +103,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true)
--FILE--
<?php
class Foo
@@ -9,9 +9,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -23,7 +23,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -35,14 +35,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
parent::__clone();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -55,7 +55,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true)
--FILE--
<?php
class Foo
@@ -9,9 +9,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -23,7 +23,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -34,14 +34,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -54,7 +54,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', false)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', false)
--FILE--
<?php
class Foo
@@ -9,9 +9,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -23,7 +23,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -34,14 +34,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -54,7 +54,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true)
--FILE--
<?php
class Foo
@@ -9,9 +9,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -23,7 +23,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -34,14 +34,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -54,7 +54,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true)
--FILE--
<?php
interface IFoo
@@ -14,9 +14,9 @@ class Foo implements IFoo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -28,7 +28,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -39,14 +39,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -59,7 +59,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true)
--FILE--
<?php
interface IFoo
@@ -14,9 +14,9 @@ class Foo implements IFoo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -28,7 +28,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -39,14 +39,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -59,7 +59,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array('bar'), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array('bar'), 'MockFoo', true, true)
--FILE--
<?php
class Foo
@@ -13,9 +13,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -28,7 +28,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -53,7 +53,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'bar', $arguments, '', $this, true
)
);
@@ -61,14 +61,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -81,7 +81,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('ClassWithDeprecatedMethod', array(), 'MockFoo', TRUE, TRUE)
\PHPUnit\Framework\MockObject\Generator::generate('ClassWithDeprecatedMethod', array(), 'MockFoo', TRUE, TRUE)
--FILE--
<?php
class ClassWithDeprecatedMethod
@@ -15,7 +15,7 @@ class ClassWithDeprecatedMethod
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'ClassWithDeprecatedMethod',
@@ -28,7 +28,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends ClassWithDeprecatedMethod implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends ClassWithDeprecatedMethod implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -55,7 +55,7 @@ class MockFoo extends ClassWithDeprecatedMethod implements PHPUnit_Framework_Moc
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'ClassWithDeprecatedMethod', 'deprecatedMethod', $arguments, '', $this, true
)
);
@@ -63,14 +63,14 @@ class MockFoo extends ClassWithDeprecatedMethod implements PHPUnit_Framework_Moc
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -83,7 +83,7 @@ class MockFoo extends ClassWithDeprecatedMethod implements PHPUnit_Framework_Moc
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
class Foo
@@ -9,9 +9,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -24,7 +24,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -49,7 +49,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'method', $arguments, '', $this, true
)
);
@@ -57,7 +57,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
public function expects(\PHPUnit\Framework\MockObject\Matcher\Invocation $matcher)
{
return $this->__phpunit_getInvocationMocker()->expects($matcher);
}
@@ -70,7 +70,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -0,0 +1,103 @@
--TEST--
\PHPUnit\Framework\MockObject\Generator::generate('ClassWithMethodWithVariadicArguments', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!version_compare(PHP_VERSION, '7.1', '>=')) print 'skip: PHP >= 7.1 required';
?>
--FILE--
<?php
class ClassWithMethodWithNullableTypehintedVariadicArguments
{
public function methodWithNullableTypehintedVariadicArguments($a, ?string ...$parameters)
{
}
}
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'ClassWithMethodWithNullableTypehintedVariadicArguments',
array(),
'MockFoo',
true,
true
);
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends ClassWithMethodWithNullableTypehintedVariadicArguments implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
private $__phpunit_configurable = ['methodwithnullabletypehintedvariadicarguments'];
public function __clone()
{
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function methodWithNullableTypehintedVariadicArguments($a, ?string ...$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\ObjectInvocation(
'ClassWithMethodWithNullableTypehintedVariadicArguments', 'methodWithNullableTypehintedVariadicArguments', $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($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;
}
public function __phpunit_hasMatchers()
{
return $this->__phpunit_getInvocationMocker()->hasMatchers();
}
public function __phpunit_verify($unsetInvocationMocker = true)
{
$this->__phpunit_getInvocationMocker()->verify();
if ($unsetInvocationMocker) {
$this->__phpunit_invocationMocker = null;
}
}
}

View File

@@ -0,0 +1,99 @@
--TEST--
\PHPUnit\Framework\MockObject\Generator::generate('ClassWithMethodWithVariadicArguments', array(), 'MockFoo', true, true)
--FILE--
<?php
class ClassWithMethodWithTypehintedVariadicArguments
{
public function methodWithTypehintedVariadicArguments($a, string ...$parameters)
{
}
}
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'ClassWithMethodWithTypehintedVariadicArguments',
array(),
'MockFoo',
true,
true
);
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends ClassWithMethodWithTypehintedVariadicArguments implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
private $__phpunit_configurable = ['methodwithtypehintedvariadicarguments'];
public function __clone()
{
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function methodWithTypehintedVariadicArguments($a, string ...$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\ObjectInvocation(
'ClassWithMethodWithTypehintedVariadicArguments', 'methodWithTypehintedVariadicArguments', $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($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;
}
public function __phpunit_hasMatchers()
{
return $this->__phpunit_getInvocationMocker()->hasMatchers();
}
public function __phpunit_verify($unsetInvocationMocker = true)
{
$this->__phpunit_getInvocationMocker()->verify();
if ($unsetInvocationMocker) {
$this->__phpunit_invocationMocker = null;
}
}
}

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('ClassWithMethodWithVariadicArguments', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('ClassWithMethodWithVariadicArguments', array(), 'MockFoo', true, true)
--FILE--
<?php
class ClassWithMethodWithVariadicArguments
@@ -9,9 +9,9 @@ class ClassWithMethodWithVariadicArguments
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'ClassWithMethodWithVariadicArguments',
@@ -24,7 +24,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends ClassWithMethodWithVariadicArguments implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends ClassWithMethodWithVariadicArguments implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -49,7 +49,7 @@ class MockFoo extends ClassWithMethodWithVariadicArguments implements PHPUnit_Fr
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'ClassWithMethodWithVariadicArguments', 'methodWithVariadicArguments', $arguments, '', $this, true
)
);
@@ -57,14 +57,14 @@ class MockFoo extends ClassWithMethodWithVariadicArguments implements PHPUnit_Fr
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -77,7 +77,7 @@ class MockFoo extends ClassWithMethodWithVariadicArguments implements PHPUnit_Fr
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
interface Foo
@@ -7,9 +7,9 @@ interface Foo
public function bar(Foo $foo);
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -22,7 +22,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
class MockFoo implements PHPUnit\Framework\MockObject\MockObject, Foo
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -47,7 +47,7 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'bar', $arguments, '', $this, true
)
);
@@ -55,14 +55,14 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -75,7 +75,7 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true, true)
--FILE--
<?php
class Foo
@@ -13,9 +13,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -29,7 +29,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -54,7 +54,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'bar', $arguments, '', $this, true
)
);
@@ -76,7 +76,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'baz', $arguments, '', $this, true
)
);
@@ -84,14 +84,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -104,7 +104,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('NS\Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
namespace NS;
@@ -15,9 +15,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'NS\Foo',
@@ -30,7 +30,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -55,7 +55,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'NS\Foo', 'bar', $arguments, '', $this, true
)
);
@@ -77,7 +77,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'NS\Foo', 'baz', $arguments, '', $this, true
)
);
@@ -85,14 +85,14 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -105,7 +105,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', true)
\PHPUnit\Framework\MockObject\Generator::generate('NS\Foo', array(), 'MockFoo', true)
--FILE--
<?php
namespace NS;
@@ -11,9 +11,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'NS\Foo',
@@ -25,7 +25,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -37,14 +37,14 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
parent::__clone();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -57,7 +57,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', true)
\PHPUnit\Framework\MockObject\Generator::generate('NS\Foo', array(), 'MockFoo', true)
--FILE--
<?php
namespace NS;
@@ -11,9 +11,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'NS\Foo',
@@ -25,7 +25,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -36,14 +36,14 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -56,7 +56,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', false)
\PHPUnit\Framework\MockObject\Generator::generate('NS\Foo', array(), 'MockFoo', false)
--FILE--
<?php
namespace NS;
@@ -11,9 +11,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'NS\Foo',
@@ -25,7 +25,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -36,14 +36,14 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -56,7 +56,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', true)
\PHPUnit\Framework\MockObject\Generator::generate('NS\Foo', array(), 'MockFoo', true)
--FILE--
<?php
namespace NS;
@@ -11,9 +11,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'NS\Foo',
@@ -25,7 +25,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -36,14 +36,14 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -56,7 +56,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', true)
\PHPUnit\Framework\MockObject\Generator::generate('NS\Foo', array(), 'MockFoo', true)
--FILE--
<?php
namespace NS;
@@ -16,9 +16,9 @@ class Foo implements IFoo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'NS\Foo',
@@ -30,7 +30,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -41,14 +41,14 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -61,7 +61,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', true)
\PHPUnit\Framework\MockObject\Generator::generate('NS\Foo', array(), 'MockFoo', true)
--FILE--
<?php
namespace NS;
@@ -16,9 +16,9 @@ class Foo implements IFoo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'NS\Foo',
@@ -30,7 +30,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -41,14 +41,14 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -61,7 +61,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array('bar'), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('NS\Foo', array('bar'), 'MockFoo', true, true)
--FILE--
<?php
namespace NS;
@@ -15,9 +15,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'NS\Foo',
@@ -30,7 +30,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -55,7 +55,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'NS\Foo', 'bar', $arguments, '', $this, true
)
);
@@ -63,14 +63,14 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -83,7 +83,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('NS\Foo', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('NS\Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
namespace NS;
@@ -9,9 +9,9 @@ interface Foo
public function bar(Foo $foo);
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new \PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'NS\Foo',
@@ -24,7 +24,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo implements PHPUnit_Framework_MockObject_MockObject, NS\Foo
class MockFoo implements PHPUnit\Framework\MockObject\MockObject, NS\Foo
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -49,7 +49,7 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, NS\Foo
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'NS\Foo', 'bar', $arguments, '', $this, true
)
);
@@ -57,14 +57,14 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, NS\Foo
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -77,7 +77,7 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, NS\Foo
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,10 +1,10 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('NonExistentClass', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('NonExistentClass', array(), 'MockFoo', true, true)
--FILE--
<?php
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'NonExistentClass',
@@ -21,7 +21,7 @@ class NonExistentClass
{
}
class MockFoo extends NonExistentClass implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends NonExistentClass implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -32,14 +32,14 @@ class MockFoo extends NonExistentClass implements PHPUnit_Framework_MockObject_M
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -52,7 +52,7 @@ class MockFoo extends NonExistentClass implements PHPUnit_Framework_MockObject_M
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,10 +1,10 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'NS\Foo',
@@ -27,7 +27,7 @@ class Foo
namespace {
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -38,14 +38,14 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -58,7 +58,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,10 +1,10 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'\NS\Foo',
@@ -27,7 +27,7 @@ class Foo
namespace {
class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -38,14 +38,14 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -58,7 +58,7 @@ class MockFoo extends NS\Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!version_compare(PHP_VERSION, '7.1', '>=')) print 'skip: PHP >= 7.1 required';
@@ -13,9 +13,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -28,7 +28,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -53,7 +53,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'bar', $arguments, '', $this, true
)
);
@@ -61,14 +61,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -81,7 +81,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', null, 'ProxyFoo', true, true, true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', null, 'ProxyFoo', true, true, true, true)
--FILE--
<?php
class Foo
@@ -13,9 +13,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo', array(), 'ProxyFoo', true, true, true, true
@@ -24,7 +24,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class ProxyFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class ProxyFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -49,7 +49,7 @@ class ProxyFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'bar', $arguments, '', $this, true
)
);
@@ -71,7 +71,7 @@ class ProxyFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'baz', $arguments, '', $this, true
)
);
@@ -79,14 +79,14 @@ class ProxyFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
return call_user_func_array(array($this->__phpunit_originalObject, "baz"), $arguments);
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -99,7 +99,7 @@ class ProxyFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -0,0 +1,97 @@
--TEST--
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
interface Foo
{
public function bar(): Closure;
}
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;
private $__phpunit_configurable = ['bar'];
public function __clone()
{
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function bar(): Closure
{
$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\ObjectInvocation(
'Foo', 'bar', $arguments, 'Closure', $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($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;
}
public function __phpunit_hasMatchers()
{
return $this->__phpunit_getInvocationMocker()->hasMatchers();
}
public function __phpunit_verify($unsetInvocationMocker = true)
{
$this->__phpunit_getInvocationMocker()->verify();
if ($unsetInvocationMocker) {
$this->__phpunit_invocationMocker = null;
}
}
}

View File

@@ -0,0 +1,108 @@
--TEST--
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!version_compare(PHP_VERSION, '7.0', '>=')) print 'skip: PHP >= 7.0 required';
?>
--FILE--
<?php
final class FinalClass
{
}
class Foo
{
public function bar(): FinalClass
{
return new FinalClass();
}
}
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;
private $__phpunit_configurable = ['bar'];
public function __clone()
{
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function bar(): FinalClass
{
$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\ObjectInvocation(
'Foo', 'bar', $arguments, 'FinalClass', $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($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;
}
public function __phpunit_hasMatchers()
{
return $this->__phpunit_getInvocationMocker()->hasMatchers();
}
public function __phpunit_verify($unsetInvocationMocker = true)
{
$this->__phpunit_getInvocationMocker()->verify();
if ($unsetInvocationMocker) {
$this->__phpunit_invocationMocker = null;
}
}
}

View File

@@ -0,0 +1,97 @@
--TEST--
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
interface Foo
{
public function bar(): Generator;
}
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;
private $__phpunit_configurable = ['bar'];
public function __clone()
{
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function bar(): Generator
{
$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\ObjectInvocation(
'Foo', 'bar', $arguments, 'Generator', $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($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;
}
public function __phpunit_hasMatchers()
{
return $this->__phpunit_getInvocationMocker()->hasMatchers();
}
public function __phpunit_verify($unsetInvocationMocker = true)
{
$this->__phpunit_getInvocationMocker()->verify();
if ($unsetInvocationMocker) {
$this->__phpunit_invocationMocker = null;
}
}
}

View File

@@ -0,0 +1,101 @@
--TEST--
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!version_compare(PHP_VERSION, '7.1', '>=')) print 'skip: PHP >= 7.1 required';
?>
--FILE--
<?php
interface Foo
{
public function bar(string $baz): ?string;
}
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;
private $__phpunit_configurable = ['bar'];
public function __clone()
{
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function bar(string $baz): ?string
{
$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\ObjectInvocation(
'Foo', 'bar', $arguments, '?string', $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($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;
}
public function __phpunit_hasMatchers()
{
return $this->__phpunit_getInvocationMocker()->hasMatchers();
}
public function __phpunit_verify($unsetInvocationMocker = true)
{
$this->__phpunit_getInvocationMocker()->verify();
if ($unsetInvocationMocker) {
$this->__phpunit_invocationMocker = null;
}
}
}

View File

@@ -1,9 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!version_compare(PHP_VERSION, '7.0', '>=')) print 'skip: PHP >= 7.0 required';
?>
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
class Foo
@@ -14,9 +10,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -29,7 +25,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -54,7 +50,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'bar', $arguments, 'Bar', $this, true
)
);
@@ -62,14 +58,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -82,7 +78,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,9 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!version_compare(PHP_VERSION, '7.0', '>=')) print 'skip: PHP >= 7.0 required';
?>
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
interface Foo
@@ -11,9 +7,9 @@ interface Foo
public function bar(string $baz): self;
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -26,7 +22,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
class MockFoo implements PHPUnit\Framework\MockObject\MockObject, Foo
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -51,7 +47,7 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'bar', $arguments, 'Foo', $this, true
)
);
@@ -59,14 +55,14 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -79,7 +75,7 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,9 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!version_compare(PHP_VERSION, '7.0', '>=')) print 'skip: PHP >= 7.0 required';
?>
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
class Foo
@@ -14,9 +10,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -29,7 +25,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -42,17 +38,17 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public static function bar(string $baz): Bar
{
throw new PHPUnit_Framework_MockObject_BadMethodCallException('Static method "bar" cannot be invoked on mock object');
throw new \PHPUnit\Framework\MockObject\BadMethodCallException('Static method "bar" cannot be invoked on mock object');
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -65,7 +61,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,5 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!version_compare(PHP_VERSION, '7.1', '>=')) print 'skip: PHP >= 7.1 required';
@@ -11,9 +11,9 @@ interface Foo
public function bar(string $baz): void;
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -26,7 +26,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
class MockFoo implements PHPUnit\Framework\MockObject\MockObject, Foo
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -51,20 +51,20 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
}
$this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'bar', $arguments, 'void', $this, true
)
);
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -77,7 +77,7 @@ class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,9 +1,5 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!version_compare(PHP_VERSION, '7.0', '>=')) print 'skip: PHP >= 7.0 required';
?>
\PHPUnit\Framework\MockObject\Generator::generate('Foo', array(), 'MockFoo', true, true)
--FILE--
<?php
class Foo
@@ -13,9 +9,9 @@ class Foo
}
}
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(
'Foo',
@@ -28,7 +24,7 @@ $mock = $generator->generate(
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
@@ -53,7 +49,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
'Foo', 'bar', $arguments, '', $this, true
)
);
@@ -61,14 +57,14 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
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;
$any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
@@ -81,7 +77,7 @@ class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this->__phpunit_configurable);
$this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
}
return $this->__phpunit_invocationMocker;

View File

@@ -1,17 +1,17 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl('GoogleSearch.wsdl', 'GoogleSearch')
\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';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
print $generator->generateClassFromWsdl(
__DIR__ . '/../../_fixture/GoogleSearch.wsdl',
__DIR__ . '/../_fixture/GoogleSearch.wsdl',
'GoogleSearch'
);
?>

View File

@@ -1,17 +1,17 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl('GoogleSearch.wsdl', 'GoogleSearch')
\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';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
print $generator->generateClassFromWsdl(
__DIR__ . '/../../_fixture/GoogleSearch.wsdl',
__DIR__ . '/../_fixture/GoogleSearch.wsdl',
'My\\Space\\GoogleSearch'
);
?>

View File

@@ -1,17 +1,17 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generateClassFromWsdl('GoogleSearch.wsdl', 'GoogleSearch', array('doGoogleSearch'))
\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';
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$generator = new \PHPUnit\Framework\MockObject\Generator;
print $generator->generateClassFromWsdl(
__DIR__ . '/../../_fixture/GoogleSearch.wsdl',
__DIR__ . '/../_fixture/GoogleSearch.wsdl',
'GoogleSearch',
array('doGoogleSearch')
);

View File

@@ -1,28 +1,49 @@
<?php
class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
/*
* This file is part of the phpunit-mock-objects 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.
*/
use PHPUnit\Framework\MockObject\Generator;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
/**
* @covers \PHPUnit\Framework\MockObject\Generator
*
* @uses \PHPUnit\Framework\MockObject\InvocationMocker
* @uses \PHPUnit\Framework\MockObject\Builder\InvocationMocker
* @uses \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation
* @uses \PHPUnit\Framework\MockObject\Invocation\StaticInvocation
* @uses \PHPUnit\Framework\MockObject\Matcher
* @uses \PHPUnit\Framework\MockObject\Matcher\InvokedRecorder
* @uses \PHPUnit\Framework\MockObject\Matcher\MethodName
* @uses \PHPUnit\Framework\MockObject\Stub\ReturnStub
* @uses \PHPUnit\Framework\MockObject\Matcher\InvokedCount
*/
class GeneratorTest extends TestCase
{
/**
* @var PHPUnit_Framework_MockObject_Generator
* @var Generator
*/
protected $generator;
private $generator;
protected function setUp()
{
$this->generator = new PHPUnit_Framework_MockObject_Generator;
$this->generator = new Generator;
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
* @expectedException PHPUnit_Framework_MockObject_RuntimeException
*/
public function testGetMockFailsWhenInvalidFunctionNameIsPassedInAsAFunctionToMock()
{
$this->expectException(\PHPUnit\Framework\MockObject\RuntimeException::class);
$this->generator->getMock(stdClass::class, [0]);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
*/
public function testGetMockCanCreateNonExistingFunctions()
{
$mock = $this->generator->getMock(stdClass::class, ['testFunction']);
@@ -30,19 +51,15 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertTrue(method_exists($mock, 'testFunction'));
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
* @expectedException PHPUnit_Framework_MockObject_RuntimeException
* @expectedExceptionMessage duplicates: "foo, bar, foo" (duplicate: "foo")
*/
public function testGetMockGeneratorFails()
{
$this->expectException(\PHPUnit\Framework\MockObject\RuntimeException::class);
$this->expectExceptionMessage('duplicates: "foo, bar, foo" (duplicate: "foo")');
$this->generator->getMock(stdClass::class, ['foo', 'bar', 'foo']);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
* @covers PHPUnit_Framework_MockObject_Generator::isMethodNameBlacklisted
* @requires PHP 7
*/
public function testGetMockBlacklistedMethodNamesPhp7()
@@ -53,9 +70,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf(InterfaceWithSemiReservedMethodName::class, $mock);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
*/
public function testGetMockForAbstractClassDoesNotFailWhenFakingInterfaces()
{
$mock = $this->generator->getMockForAbstractClass(Countable::class);
@@ -63,9 +77,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertTrue(method_exists($mock, 'count'));
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
*/
public function testGetMockForAbstractClassStubbingAbstractClass()
{
$mock = $this->generator->getMockForAbstractClass(AbstractMockTestClass::class);
@@ -73,9 +84,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertTrue(method_exists($mock, 'doSomething'));
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
*/
public function testGetMockForAbstractClassWithNonExistentMethods()
{
$mock = $this->generator->getMockForAbstractClass(
@@ -92,9 +100,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertTrue(method_exists($mock, 'doSomething'));
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
*/
public function testGetMockForAbstractClassShouldCreateStubsOnlyForAbstractMethodWhenNoMethodsWereInformed()
{
$mock = $this->generator->getMockForAbstractClass(AbstractMockTestClass::class);
@@ -109,20 +114,18 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
/**
* @dataProvider getMockForAbstractClassExpectsInvalidArgumentExceptionDataprovider
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
* @expectedException PHPUnit_Framework_Exception
*/
public function testGetMockForAbstractClassExpectingInvalidArgumentException($className, $mockClassName)
{
$this->expectException(PHPUnit\Framework\Exception::class);
$this->generator->getMockForAbstractClass($className, [], $mockClassName);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
* @expectedException PHPUnit_Framework_MockObject_RuntimeException
*/
public function testGetMockForAbstractClassAbstractClassDoesNotExist()
{
$this->expectException(\PHPUnit\Framework\MockObject\RuntimeException::class);
$this->generator->getMockForAbstractClass('Tux');
}
@@ -134,9 +137,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
];
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForTrait
*/
public function testGetMockForTraitWithNonExistentMethodsAndNonAbstractMethods()
{
$mock = $this->generator->getMockForTrait(
@@ -155,9 +155,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertTrue($mock->anotherMockableMethod());
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForTrait
*/
public function testGetMockForTraitStubbingAbstractMethod()
{
$mock = $this->generator->getMockForTrait(AbstractTrait::class);
@@ -172,18 +169,14 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf('SingletonClass', $mock);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
* @expectedException PHPUnit_Framework_MockObject_RuntimeException
*/
public function testExceptionIsRaisedForMutuallyExclusiveOptions()
{
$this->expectException(\PHPUnit\Framework\MockObject\RuntimeException::class);
$this->generator->getMock(stdClass::class, [], [], '', false, true, true, true, true);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
*
* @requires PHP 7
*/
public function testCanImplementInterfacesThatHaveMethodsWithReturnTypes()
@@ -192,14 +185,9 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf(AnInterfaceWithReturnType::class, $stub);
$this->assertInstanceOf(AnInterface::class, $stub);
$this->assertInstanceOf(PHPUnit_Framework_MockObject_MockObject::class, $stub);
$this->assertInstanceOf(MockObject::class, $stub);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
*
* @ticket https://github.com/sebastianbergmann/phpunit-mock-objects/issues/322
*/
public function testCanConfigureMethodsForDoubleOfNonExistentClass()
{
$className = 'X' . md5(microtime());
@@ -209,9 +197,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf($className, $mock);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
*/
public function testCanInvokeMethodsOfNonExistentClass()
{
$className = 'X' . md5(microtime());

View File

@@ -1,11 +1,23 @@
<?php
class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestCase
/*
* This file is part of the phpunit-mock-objects 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.
*/
use PHPUnit\Framework\MockObject\Invocation\ObjectInvocation;
use PHPUnit\Framework\TestCase;
class ObjectInvocationTest extends TestCase
{
public function testConstructorRequiresClassAndMethodAndParametersAndObject()
{
$this->assertInstanceOf(
PHPUnit_Framework_MockObject_Invocation_Object::class,
new PHPUnit_Framework_MockObject_Invocation_Object(
ObjectInvocation::class,
new ObjectInvocation(
'FooClass',
'FooMethod',
['an_argument'],
@@ -17,7 +29,7 @@ class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestC
public function testAllowToGetClassNameSetInConstructor()
{
$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
$invocation = new ObjectInvocation(
'FooClass',
'FooMethod',
['an_argument'],
@@ -25,12 +37,12 @@ class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestC
new stdClass
);
$this->assertSame('FooClass', $invocation->className);
$this->assertSame('FooClass', $invocation->getClassName());
}
public function testAllowToGetMethodNameSetInConstructor()
{
$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
$invocation = new ObjectInvocation(
'FooClass',
'FooMethod',
['an_argument'],
@@ -38,14 +50,14 @@ class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestC
new stdClass
);
$this->assertSame('FooMethod', $invocation->methodName);
$this->assertSame('FooMethod', $invocation->getMethodName());
}
public function testAllowToGetObjectSetInConstructor()
{
$expectedObject = new stdClass;
$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
$invocation = new ObjectInvocation(
'FooClass',
'FooMethod',
['an_argument'],
@@ -53,7 +65,7 @@ class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestC
$expectedObject
);
$this->assertSame($expectedObject, $invocation->object);
$this->assertSame($expectedObject, $invocation->getObject());
}
public function testAllowToGetMethodParametersSetInConstructor()
@@ -62,7 +74,7 @@ class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestC
'foo', 5, ['a', 'b'], new stdClass, null, false
];
$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
$invocation = new ObjectInvocation(
'FooClass',
'FooMethod',
$expectedParameters,
@@ -70,7 +82,7 @@ class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestC
new stdClass
);
$this->assertSame($expectedParameters, $invocation->parameters);
$this->assertSame($expectedParameters, $invocation->getParameters());
}
public function testConstructorAllowToSetFlagCloneObjectsInParameters()
@@ -78,7 +90,7 @@ class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestC
$parameters = [new stdClass];
$cloneObjects = true;
$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
$invocation = new ObjectInvocation(
'FooClass',
'FooMethod',
$parameters,
@@ -87,15 +99,15 @@ class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestC
$cloneObjects
);
$this->assertEquals($parameters, $invocation->parameters);
$this->assertNotSame($parameters, $invocation->parameters);
$this->assertEquals($parameters, $invocation->getParameters());
$this->assertNotSame($parameters, $invocation->getParameters());
}
public function testAllowToGetReturnTypeSetInConstructor()
{
$expectedReturnType = 'string';
$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
$invocation = new ObjectInvocation(
'FooClass',
'FooMethod',
['an_argument'],
@@ -103,6 +115,6 @@ class Framework_MockObject_Invocation_ObjectTest extends PHPUnit_Framework_TestC
new stdClass
);
$this->assertSame($expectedReturnType, $invocation->returnType);
$this->assertSame($expectedReturnType, $invocation->getReturnType());
}
}

View File

@@ -1,11 +1,23 @@
<?php
class Framework_MockObject_Invocation_StaticTest extends PHPUnit_Framework_TestCase
/*
* This file is part of the phpunit-mock-objects 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.
*/
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\MockObject\Invocation\StaticInvocation;
class StaticInvocationTest extends TestCase
{
public function testConstructorRequiresClassAndMethodAndParameters()
{
$this->assertInstanceOf(
PHPUnit_Framework_MockObject_Invocation_Static::class,
new PHPUnit_Framework_MockObject_Invocation_Static(
StaticInvocation::class,
new StaticInvocation(
'FooClass',
'FooMethod',
['an_argument'],
@@ -16,26 +28,26 @@ class Framework_MockObject_Invocation_StaticTest extends PHPUnit_Framework_TestC
public function testAllowToGetClassNameSetInConstructor()
{
$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
$invocation = new StaticInvocation(
'FooClass',
'FooMethod',
['an_argument'],
'ReturnType'
);
$this->assertSame('FooClass', $invocation->className);
$this->assertSame('FooClass', $invocation->getClassName());
}
public function testAllowToGetMethodNameSetInConstructor()
{
$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
$invocation = new StaticInvocation(
'FooClass',
'FooMethod',
['an_argument'],
'ReturnType'
);
$this->assertSame('FooMethod', $invocation->methodName);
$this->assertSame('FooMethod', $invocation->getMethodName());
}
public function testAllowToGetMethodParametersSetInConstructor()
@@ -44,14 +56,14 @@ class Framework_MockObject_Invocation_StaticTest extends PHPUnit_Framework_TestC
'foo', 5, ['a', 'b'], new stdClass, null, false
];
$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
$invocation = new StaticInvocation(
'FooClass',
'FooMethod',
$expectedParameters,
'ReturnType'
);
$this->assertSame($expectedParameters, $invocation->parameters);
$this->assertSame($expectedParameters, $invocation->getParameters());
}
public function testConstructorAllowToSetFlagCloneObjectsInParameters()
@@ -59,7 +71,7 @@ class Framework_MockObject_Invocation_StaticTest extends PHPUnit_Framework_TestC
$parameters = [new stdClass];
$cloneObjects = true;
$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
$invocation = new StaticInvocation(
'FooClass',
'FooMethod',
$parameters,
@@ -67,21 +79,21 @@ class Framework_MockObject_Invocation_StaticTest extends PHPUnit_Framework_TestC
$cloneObjects
);
$this->assertEquals($parameters, $invocation->parameters);
$this->assertNotSame($parameters, $invocation->parameters);
$this->assertEquals($parameters, $invocation->getParameters());
$this->assertNotSame($parameters, $invocation->getParameters());
}
public function testAllowToGetReturnTypeSetInConstructor()
{
$expectedReturnType = 'string';
$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
$invocation = new StaticInvocation(
'FooClass',
'FooMethod',
['an_argument'],
$expectedReturnType
);
$this->assertSame($expectedReturnType, $invocation->returnType);
$this->assertSame($expectedReturnType, $invocation->getReturnType());
}
}

View File

@@ -1,5 +1,17 @@
<?php
class Framework_MockObject_Matcher_ConsecutiveParametersTest extends PHPUnit_Framework_TestCase
/*
* This file is part of the phpunit-mock-objects 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.
*/
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\ExpectationFailedException;
class ConsecutiveParametersTest extends TestCase
{
public function testIntegration()
{
@@ -49,7 +61,7 @@ class Framework_MockObject_Matcher_ConsecutiveParametersTest extends PHPUnit_Fra
$mock->foo('bar');
$this->expectException(PHPUnit_Framework_ExpectationFailedException::class);
$this->expectException(ExpectationFailedException::class);
$mock->foo('invalid');
}

View File

@@ -1,6 +1,6 @@
<?php
/*
* This file is part of the PHPUnit_MockObject package.
* This file is part of the phpunit-mock-objects package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
@@ -8,7 +8,10 @@
* file that was distributed with this source code.
*/
class Framework_MockBuilderTest extends PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\MockObject\MockBuilder;
class MockBuilderTest extends TestCase
{
public function testMockBuilderRequiresClassName()
{
@@ -121,6 +124,6 @@ class Framework_MockBuilderTest extends PHPUnit_Framework_TestCase
->disableOriginalClone()
->disableAutoload();
$this->assertTrue($spec instanceof PHPUnit_Framework_MockObject_MockBuilder);
$this->assertTrue($spec instanceof MockBuilder);
}
}

View File

@@ -1,6 +1,6 @@
<?php
/*
* This file is part of the PHPUnit_MockObject package.
* This file is part of the phpunit-mock-objects package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
@@ -8,7 +8,11 @@
* file that was distributed with this source code.
*/
class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\ExpectationFailedException;
class MockObjectTest extends TestCase
{
public function testMockedMethodIsNeverCalled()
{
@@ -167,9 +171,9 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
$mock->expects($this->any())
->method('doSomething')
->will($this->throwException(new Exception));
->will($this->throwException(new \Exception()));
$this->expectException(Exception::class);
$this->expectException(\Exception::class);
$mock->doSomething();
}
@@ -181,9 +185,9 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
$mock->expects($this->any())
->method('doSomething')
->willThrowException(new Exception);
->willThrowException(new \Exception());
$this->expectException(Exception::class);
$this->expectException(\Exception::class);
$mock->doSomething();
}
@@ -429,9 +433,6 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
$this->assertNotEquals(get_class($mock4), get_class($mock5));
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
*/
public function testGetMockWithFixedClassNameCanProduceTheSameMockTwice()
{
$mock = $this->getMockBuilder(stdClass::class)->setMockClassName('FixedName')->getMock();
@@ -658,10 +659,10 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
try {
$mock->__phpunit_verify();
$this->fail('Expected exception');
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
} catch (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",
'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . PHP_EOL .
'Method was expected to be called 1 times, actually called 0 times.' . PHP_EOL,
$e->getMessage()
);
}
@@ -683,10 +684,10 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
try {
$mock->__phpunit_verify();
$this->fail('Expected exception');
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
} catch (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",
'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . PHP_EOL .
'Method was expected to be called 1 times, actually called 0 times.' . PHP_EOL,
$e->getMessage()
);
}
@@ -706,31 +707,33 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
try {
$mock->right(['second']);
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
} catch (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.',
'Expectation failed for method name is equal to "right" when invoked 1 time(s)' . PHP_EOL .
'Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.' . PHP_EOL .
'Failed asserting that two arrays are equal.',
$e->getMessage()
);
}
try {
$mock->__phpunit_verify();
$this->fail('Expected exception');
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
// CHECKOUT THIS MORE CAREFULLY
// $this->fail('Expected exception');
} catch (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",
'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . PHP_EOL .
'Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.' . PHP_EOL .
'Failed asserting that two arrays are equal.' . PHP_EOL .
'--- Expected' . PHP_EOL .
'+++ Actual' . PHP_EOL .
'@@ @@' . PHP_EOL .
' Array (' . PHP_EOL .
'- 0 => \'first\'' . PHP_EOL .
'- 1 => \'second\'' . PHP_EOL .
'+ 0 => \'second\'' . PHP_EOL,
$e->getMessage()
);
}
@@ -751,7 +754,7 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
try {
$mock->right();
$this->fail('Expected exception');
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
} catch (ExpectationFailedException $e) {
$this->assertSame(
'SomeClass::right() was not expected to be called.',
$e->getMessage()
@@ -774,7 +777,7 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
try {
$mock->right();
$this->fail('Expected exception');
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
} catch (ExpectationFailedException $e) {
$this->assertSame(
'SomeClass::right() was not expected to be called.',
$e->getMessage()
@@ -797,10 +800,10 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
try {
$mock->right();
$this->fail('Expected exception');
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
} catch (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" .
'Expectation failed for method name is equal to "right" when invoked 1 time(s)' . PHP_EOL .
'Parameter count for invocation SomeClass::right() is too low.' . PHP_EOL .
'To allow 0 or more parameters with any value, omit ->with() or use ->withAnyParameters() instead.',
$e->getMessage()
);
@@ -950,13 +953,12 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
);
}
/**
* @expectedException PHPUnit_Framework_MockObject_BadMethodCallException
*/
public function testInvokingStubbedStaticMethodRaisesException()
{
$mock = $this->getMockBuilder(ClassWithStaticMethod::class)->getMock();
$this->expectException(\PHPUnit\Framework\MockObject\BadMethodCallException::class);
$mock->staticMethod();
}
@@ -1034,4 +1036,40 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
$mock->bar('call_' . $i);
}
}
public function testReturnTypesAreMockedCorrectly()
{
/** @var ClassWithAllPossibleReturnTypes|MockObject $stub */
$stub = $this->createMock(ClassWithAllPossibleReturnTypes::class);
$this->assertNull($stub->methodWithNoReturnTypeDeclaration());
$this->assertSame('', $stub->methodWithStringReturnTypeDeclaration());
$this->assertSame(0.0, $stub->methodWithFloatReturnTypeDeclaration());
$this->assertSame(0, $stub->methodWithIntReturnTypeDeclaration());
$this->assertFalse($stub->methodWithBoolReturnTypeDeclaration());
$this->assertSame([], $stub->methodWithArrayReturnTypeDeclaration());
$this->assertInstanceOf(MockObject::class, $stub->methodWithClassReturnTypeDeclaration());
}
/**
* @requires PHP 7.1
*/
public function testVoidReturnTypeIsMockedCorrectly()
{
/** @var ClassWithAllPossibleReturnTypes|MockObject $stub */
$stub = $this->createMock(ClassWithAllPossibleReturnTypes::class);
$this->assertNull($stub->methodWithVoidReturnTypeDeclaration());
}
/**
* @requires PHP 7.2
*/
public function testObjectReturnTypeIsMockedCorrectly()
{
/** @var ClassWithAllPossibleReturnTypes|MockObject $stub */
$stub = $this->createMock(ClassWithAllPossibleReturnTypes::class);
$this->assertInstanceOf(stdClass::class, $stub->methodWithObjectReturnTypeDeclaration());
}
}

View File

@@ -1,6 +1,6 @@
<?php
/*
* This file is part of the PHPUnit_MockObject package.
* This file is part of the phpunit-mock-objects package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
@@ -8,7 +8,9 @@
* file that was distributed with this source code.
*/
class Framework_ProxyObjectTest extends PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
class ProxyObjectTest extends TestCase
{
public function testMockedMethodIsProxiedToOriginalMethod()
{

View File

@@ -1,4 +1,5 @@
<?php
interface AnInterface
{
public function doSomething();

View File

@@ -0,0 +1,56 @@
<?php
class ClassWithAllPossibleReturnTypes
{
public function methodWithNoReturnTypeDeclaration()
{
}
public function methodWithVoidReturnTypeDeclaration(): void
{
}
public function methodWithStringReturnTypeDeclaration(): string
{
return 'string';
}
public function methodWithFloatReturnTypeDeclaration(): float
{
return 1.0;
}
public function methodWithIntReturnTypeDeclaration(): int
{
return 1;
}
public function methodWithBoolReturnTypeDeclaration(): bool
{
return true;
}
public function methodWithArrayReturnTypeDeclaration(): array
{
return ['string'];
}
public function methodWithTraversableReturnTypeDeclaration(): Traversable
{
return new ArrayIterator(['string']);
}
public function methodWithGeneratorReturnTypeDeclaration(): Generator
{
yield 1;
}
public function methodWithObjectReturnTypeDeclaration(): object
{
return new Exception;
}
public function methodWithClassReturnTypeDeclaration(): stdClass
{
return new stdClass;
}
}

View File

@@ -1,4 +1,5 @@
<?php
interface TraversableMockTestInterface extends Traversable
interface TraversableMockTestInterface extends \Traversable
{
}