This repository has been archived by the owner on Jul 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
6 changed files
with
129 additions
and
4 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,34 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Phony package. | ||
* | ||
* Copyright © 2017 Erin Millard | ||
* | ||
* For the full copyright and license information, please view the LICENSE file | ||
* that was distributed with this source code. | ||
*/ | ||
|
||
use Eloquent\Phony\Phony; | ||
|
||
error_reporting(-1); | ||
|
||
describe('Phony', function () { | ||
beforeEach(function () { | ||
$this->handle = Phony::mock('Eloquent\Phony\Peridot\Test\TestClassA'); | ||
$this->mock = $this->handle->get(); | ||
}); | ||
|
||
it('should record passing mock assertions', function () { | ||
$this->mock->testClassAMethodA('aardvark', 'bonobo'); | ||
|
||
$this->handle->testClassAMethodA->calledWith('aardvark', 'bonobo'); | ||
}); | ||
|
||
it('should record failing mock assertions', function () { | ||
$this->mock->testClassAMethodA('aardvark', ['bonobo', 'capybara', 'dugong']); | ||
$this->mock->testClassAMethodA('armadillo', ['bonobo', 'chameleon', 'dormouse']); | ||
|
||
$this->handle->testClassAMethodA->calledWith('aardvark', ['bonobo', 'chameleon', 'dugong']); | ||
}); | ||
}); |
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,8 @@ | ||
#!/bin/sh | ||
|
||
echo | ||
echo =========================================================================== | ||
echo Peridot | ||
echo =========================================================================== | ||
|
||
vendor/bin/peridot test/integration |
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,75 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Phony package. | ||
* | ||
* Copyright © 2016 Erin Millard | ||
* | ||
* For the full copyright and license information, please view the LICENSE file | ||
* that was distributed with this source code. | ||
*/ | ||
|
||
namespace Eloquent\Phony\Peridot\Test; | ||
|
||
class TestClassA | ||
{ | ||
public static function testClassAStaticMethodA() | ||
{ | ||
return implode(func_get_args()); | ||
} | ||
|
||
public static function testClassAStaticMethodB($first, $second) | ||
{ | ||
return implode(func_get_args()); | ||
} | ||
|
||
public function __construct(&$first = null, &$second = null) | ||
{ | ||
$this->constructorArguments = func_get_args(); | ||
|
||
$first = 'first'; | ||
$second = 'second'; | ||
} | ||
|
||
public function testClassAMethodA() | ||
{ | ||
return implode(func_get_args()); | ||
} | ||
|
||
public function testClassAMethodB($first, $second) | ||
{ | ||
return implode(func_get_args()); | ||
} | ||
|
||
protected static function testClassAStaticMethodC() | ||
{ | ||
return 'protected ' . implode(func_get_args()); | ||
} | ||
|
||
protected static function testClassAStaticMethodD($first, $second) | ||
{ | ||
return 'protected ' . implode(func_get_args()); | ||
} | ||
|
||
protected function testClassAMethodC() | ||
{ | ||
return 'protected ' . implode(func_get_args()); | ||
} | ||
|
||
protected function testClassAMethodD(&$first, &$second) | ||
{ | ||
return 'protected ' . implode(func_get_args()); | ||
} | ||
|
||
private static function testClassAStaticMethodE() | ||
{ | ||
return 'private ' . implode(func_get_args()); | ||
} | ||
|
||
private function testClassAMethodE() | ||
{ | ||
return 'private ' . implode(func_get_args()); | ||
} | ||
|
||
public $constructorArguments; | ||
} |