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
Showing
8 changed files
with
121 additions
and
36 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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
<?php | ||
/* Copyright (c) 2011, Daniel Howlett. All rights reserved. | ||
* Released under a new BSD license. | ||
* https://github.com/dancras/Doubles/blob/master/LICENSE */ | ||
|
||
namespace Doubles\Core; | ||
|
||
/** | ||
* Use this exception to indicate that the current test has failed. | ||
*/ | ||
class FailureException extends DoublesException | ||
{ | ||
} | ||
<?php | ||
/* Copyright (c) 2011, Daniel Howlett. All rights reserved. | ||
* Released under a new BSD license. | ||
* https://github.com/dancras/Doubles/blob/master/LICENSE */ | ||
|
||
namespace Doubles\Core; | ||
|
||
/** | ||
* Use this exception to indicate that the current test has failed. | ||
*/ | ||
class FailureException extends DoublesException | ||
{ | ||
} | ||
|
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,15 @@ | ||
<?php | ||
/* Copyright (c) 2011, Daniel Howlett. All rights reserved. | ||
* Released under a new BSD license. | ||
* https://github.com/dancras/Doubles/blob/master/LICENSE */ | ||
|
||
namespace Doubles\Core; | ||
|
||
/** | ||
* Used to indicate to the generated test double that a fluent interface should | ||
* be returned. | ||
*/ | ||
class FluentInterface | ||
{ | ||
} | ||
|
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
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
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
<?php | ||
/* Copyright (c) 2011, Daniel Howlett. All rights reserved. | ||
* Released under a new BSD license. | ||
* https://github.com/dancras/Doubles/blob/master/LICENSE */ | ||
|
||
namespace Doubles\Core; | ||
|
||
/** | ||
* Use this exception to indicate that functionality is being misused. | ||
*/ | ||
class UsageException extends DoublesException | ||
{ | ||
} | ||
<?php | ||
/* Copyright (c) 2011, Daniel Howlett. All rights reserved. | ||
* Released under a new BSD license. | ||
* https://github.com/dancras/Doubles/blob/master/LICENSE */ | ||
|
||
namespace Doubles\Core; | ||
|
||
/** | ||
* Use this exception to indicate that functionality is being misused. | ||
*/ | ||
class UsageException extends DoublesException | ||
{ | ||
} | ||
|
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
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,20 @@ | ||
<?php | ||
/* Copyright (c) 2011, Daniel Howlett. All rights reserved. | ||
* Released under a new BSD license. | ||
* https://github.com/dancras/Doubles/blob/master/LICENSE */ | ||
|
||
namespace Doubles\Test; | ||
|
||
use Doubles\Core\IComponent; | ||
|
||
class DummyComponent implements IComponent | ||
{ | ||
public function whenMethodCalled($methodName, array $arguments) | ||
{ | ||
} | ||
|
||
public function dummy()# | ||
{ | ||
} | ||
} | ||
|
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,27 @@ | ||
<?php | ||
/* Copyright (c) 2011, Daniel Howlett. All rights reserved. | ||
* Released under a new BSD license. | ||
* https://github.com/dancras/Doubles/blob/master/LICENSE */ | ||
|
||
namespace Doubles; | ||
|
||
use PHPUnit_Framework_TestCase; | ||
use Doubles\Core\TestDouble; | ||
use Doubles\Test\DummyComponent; | ||
|
||
class TestDoubleTest extends PHPUnit_Framework_TestCase | ||
{ | ||
public function testWhenUndefinedMethodCalledReturnsGeneratedDoubleWhenComponentMethodReturnsNull() | ||
{ | ||
$sut = new TestDouble; | ||
|
||
$component = new DummyComponent; | ||
$sut->addComponent($component); | ||
|
||
$this->assertInstanceOf( | ||
'\Doubles\Core\FluentInterface', | ||
$sut->whenUndefinedMethodCalled('dummy', array()) | ||
); | ||
} | ||
} | ||
|