This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0839a59
commit 1a48065
Showing
31 changed files
with
2,245 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build | ||
phpunit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--TEST-- | ||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE, TRUE) | ||
--FILE-- | ||
<?php | ||
class Foo | ||
{ | ||
public function bar(Foo $foo) | ||
{ | ||
} | ||
|
||
public function baz(Foo $foo) | ||
{ | ||
} | ||
} | ||
|
||
require_once 'PHPUnit/Autoload.php'; | ||
|
||
$mock = PHPUnit_Framework_MockObject_Generator::generate( | ||
'Foo', | ||
array(), | ||
'MockFoo', | ||
TRUE, | ||
TRUE | ||
); | ||
|
||
print $mock['code']; | ||
?> | ||
--EXPECTF-- | ||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject | ||
{ | ||
protected static $staticInvocationMocker; | ||
protected $invocationMocker; | ||
|
||
public function __clone() | ||
{ | ||
$this->invocationMocker = clone $this->__phpunit_getInvocationMocker(); | ||
} | ||
|
||
public function bar(Foo $foo) | ||
{ | ||
$args = func_get_args(); | ||
|
||
$result = $this->__phpunit_getInvocationMocker()->invoke( | ||
new PHPUnit_Framework_MockObject_Invocation_Object( | ||
'Foo', 'bar', $args, $this | ||
) | ||
); | ||
|
||
return $result; | ||
} | ||
|
||
public function baz(Foo $foo) | ||
{ | ||
$args = func_get_args(); | ||
|
||
$result = $this->__phpunit_getInvocationMocker()->invoke( | ||
new PHPUnit_Framework_MockObject_Invocation_Object( | ||
'Foo', 'baz', $args, $this | ||
) | ||
); | ||
|
||
return $result; | ||
} | ||
|
||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) | ||
{ | ||
return $this->__phpunit_getInvocationMocker()->expects($matcher); | ||
} | ||
|
||
public static function staticExpects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) | ||
{ | ||
return self::__phpunit_getStaticInvocationMocker()->expects($matcher); | ||
} | ||
|
||
public function __phpunit_getInvocationMocker() | ||
{ | ||
if ($this->invocationMocker === NULL) { | ||
$this->invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this); | ||
} | ||
|
||
return $this->invocationMocker; | ||
} | ||
|
||
public static function __phpunit_getStaticInvocationMocker() | ||
{ | ||
if (self::$staticInvocationMocker === NULL) { | ||
self::$staticInvocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker; | ||
} | ||
|
||
return self::$staticInvocationMocker; | ||
} | ||
|
||
public function __phpunit_verify() | ||
{ | ||
self::__phpunit_getStaticInvocationMocker()->verify(); | ||
$this->__phpunit_getInvocationMocker()->verify(); | ||
} | ||
|
||
public function __phpunit_cleanup() | ||
{ | ||
$this->invocationMocker = NULL; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--TEST-- | ||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE) | ||
--FILE-- | ||
<?php | ||
class Foo | ||
{ | ||
public function __clone() | ||
{ | ||
} | ||
} | ||
|
||
require_once 'PHPUnit/Autoload.php'; | ||
|
||
$mock = PHPUnit_Framework_MockObject_Generator::generate( | ||
'Foo', | ||
array(), | ||
'MockFoo', | ||
TRUE | ||
); | ||
|
||
print $mock['code']; | ||
?> | ||
--EXPECTF-- | ||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject | ||
{ | ||
protected static $staticInvocationMocker; | ||
protected $invocationMocker; | ||
|
||
public function __clone() | ||
{ | ||
$this->invocationMocker = clone $this->__phpunit_getInvocationMocker(); | ||
parent::__clone(); | ||
} | ||
|
||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) | ||
{ | ||
return $this->__phpunit_getInvocationMocker()->expects($matcher); | ||
} | ||
|
||
public static function staticExpects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) | ||
{ | ||
return self::__phpunit_getStaticInvocationMocker()->expects($matcher); | ||
} | ||
|
||
public function __phpunit_getInvocationMocker() | ||
{ | ||
if ($this->invocationMocker === NULL) { | ||
$this->invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this); | ||
} | ||
|
||
return $this->invocationMocker; | ||
} | ||
|
||
public static function __phpunit_getStaticInvocationMocker() | ||
{ | ||
if (self::$staticInvocationMocker === NULL) { | ||
self::$staticInvocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker; | ||
} | ||
|
||
return self::$staticInvocationMocker; | ||
} | ||
|
||
public function __phpunit_verify() | ||
{ | ||
self::__phpunit_getStaticInvocationMocker()->verify(); | ||
$this->__phpunit_getInvocationMocker()->verify(); | ||
} | ||
|
||
public function __phpunit_cleanup() | ||
{ | ||
$this->invocationMocker = NULL; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--TEST-- | ||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', TRUE) | ||
--FILE-- | ||
<?php | ||
class Foo | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
} | ||
|
||
require_once 'PHPUnit/Autoload.php'; | ||
|
||
$mock = PHPUnit_Framework_MockObject_Generator::generate( | ||
'Foo', | ||
array(), | ||
'MockFoo', | ||
TRUE | ||
); | ||
|
||
print $mock['code']; | ||
?> | ||
--EXPECTF-- | ||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject | ||
{ | ||
protected static $staticInvocationMocker; | ||
protected $invocationMocker; | ||
|
||
public function __clone() | ||
{ | ||
$this->invocationMocker = clone $this->__phpunit_getInvocationMocker(); | ||
} | ||
|
||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) | ||
{ | ||
return $this->__phpunit_getInvocationMocker()->expects($matcher); | ||
} | ||
|
||
public static function staticExpects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) | ||
{ | ||
return self::__phpunit_getStaticInvocationMocker()->expects($matcher); | ||
} | ||
|
||
public function __phpunit_getInvocationMocker() | ||
{ | ||
if ($this->invocationMocker === NULL) { | ||
$this->invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this); | ||
} | ||
|
||
return $this->invocationMocker; | ||
} | ||
|
||
public static function __phpunit_getStaticInvocationMocker() | ||
{ | ||
if (self::$staticInvocationMocker === NULL) { | ||
self::$staticInvocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker; | ||
} | ||
|
||
return self::$staticInvocationMocker; | ||
} | ||
|
||
public function __phpunit_verify() | ||
{ | ||
self::__phpunit_getStaticInvocationMocker()->verify(); | ||
$this->__phpunit_getInvocationMocker()->verify(); | ||
} | ||
|
||
public function __phpunit_cleanup() | ||
{ | ||
$this->invocationMocker = NULL; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--TEST-- | ||
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', FALSE) | ||
--FILE-- | ||
<?php | ||
class Foo | ||
{ | ||
public function __clone() | ||
{ | ||
} | ||
} | ||
|
||
require_once 'PHPUnit/Autoload.php'; | ||
|
||
$mock = PHPUnit_Framework_MockObject_Generator::generate( | ||
'Foo', | ||
array(), | ||
'MockFoo', | ||
FALSE | ||
); | ||
|
||
print $mock['code']; | ||
?> | ||
--EXPECTF-- | ||
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject | ||
{ | ||
protected static $staticInvocationMocker; | ||
protected $invocationMocker; | ||
|
||
public function __clone() | ||
{ | ||
$this->invocationMocker = clone $this->__phpunit_getInvocationMocker(); | ||
} | ||
|
||
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) | ||
{ | ||
return $this->__phpunit_getInvocationMocker()->expects($matcher); | ||
} | ||
|
||
public static function staticExpects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher) | ||
{ | ||
return self::__phpunit_getStaticInvocationMocker()->expects($matcher); | ||
} | ||
|
||
public function __phpunit_getInvocationMocker() | ||
{ | ||
if ($this->invocationMocker === NULL) { | ||
$this->invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker($this); | ||
} | ||
|
||
return $this->invocationMocker; | ||
} | ||
|
||
public static function __phpunit_getStaticInvocationMocker() | ||
{ | ||
if (self::$staticInvocationMocker === NULL) { | ||
self::$staticInvocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker; | ||
} | ||
|
||
return self::$staticInvocationMocker; | ||
} | ||
|
||
public function __phpunit_verify() | ||
{ | ||
self::__phpunit_getStaticInvocationMocker()->verify(); | ||
$this->__phpunit_getInvocationMocker()->verify(); | ||
} | ||
|
||
public function __phpunit_cleanup() | ||
{ | ||
$this->invocationMocker = NULL; | ||
} | ||
} | ||
|
Oops, something went wrong.