Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Commit 4d3a8b3

Browse files
committed
Merge branch 'release/0.5.2'
2 parents 1d6dcb0 + 06d4f2a commit 4d3a8b3

24 files changed

+2774
-49
lines changed

.archer/travis.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
O3gWqnPXJHfHcaZscfK7RnHsLOChbPTMPd3Siw4pJBU4JluhJRto0S+EnOErce1cKLrD4zHdfPTEXEBLg8dFj2eOCbGDEuJHCguwow3UeeSQ6qnUNZOZlXIb2ajZRJtC4bB+CevyHqVYSUcGxcWmUu0faG26/xh8cHpXK3Daris=

.archer/travis.install

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
// Update composer to the latest version ...
5+
passthru('composer self-update --no-interaction');
6+
7+
// Build a composer config that uses the GitHub OAuth token if it is available ...
8+
$config = array(
9+
'config' => array(
10+
'notify-on-install' => false,
11+
),
12+
);
13+
14+
if ($token = getenv('ARCHER_TOKEN')) {
15+
$config['config']['github-oauth'] = array(
16+
'github.com' => $token,
17+
);
18+
$composerFlags = '--prefer-dist';
19+
} else {
20+
$composerFlags = '--prefer-source';
21+
}
22+
23+
$file = '~/.composer/config.json';
24+
$dir = dirname($file);
25+
if (!is_dir($dir)) {
26+
mkdir($dir, 0755, true);
27+
}
28+
file_put_contents($file, json_encode($config));
29+
30+
// Display some information about GitHub rate limiting ...
31+
if ($token) {
32+
passthru('curl -s -i -H "Authorization: token $ARCHER_TOKEN" https://api.github.com | grep "^X-RateLimit"');
33+
}
34+
35+
// Install composer dependencies ...
36+
$exitCode = 0;
37+
passthru('composer install --dev --no-progress --no-interaction --ignore-platform-reqs --ansi ' . $composerFlags, $exitCode);
38+
exit($exitCode);

.archer/travis.key

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-----BEGIN RSA PUBLIC KEY-----
2+
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC25P/GpMynmV3pDc1I3dm1qvvX
3+
sehGeUx8UUtfGeMbGxYDfA6EkivAHkM//vnW7G37crKNgzS7iMFu7J3bPI4+5V/i
4+
WU1JVTk5Bcg1buzDtKJ7Ckhvx8Z928P8PXyKHBWQwpABqoDWfmrVebTn9yMtJunt
5+
gr+BGlo1LD1uaj1XqwIDAQAB
6+
-----END RSA PUBLIC KEY-----

.gitattributes

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
/.gitattributes export-ignore
2-
/.gitignore export-ignore
3-
/.travis.* export-ignore
1+
# archer start
2+
.gitattributes export-ignore
3+
.gitignore export-ignore
4+
.travis.* export-ignore
5+
/.archer/ export-ignore
46
/test/ export-ignore
7+
# archer end
8+
9+
/doc/ export-ignore

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1+
# archer start
12
/artifacts/
23
/vendor/
4+
# archer end
5+
6+
/doc/*.html
7+
/doc/example/**/coverage/

.travis.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1+
sudo: false
12
language: php
2-
php:
3-
- "5.3.3"
4-
- "5.3"
5-
- "5.4"
6-
- "5.5"
7-
- "5.6"
8-
- nightly
9-
- hhvm
3+
4+
php: ["5.3", "5.4", "5.5", "5.6", "7.0", "hhvm"]
5+
106
matrix:
11-
allow_failures:
12-
- php: nightly
13-
- php: hhvm
7+
allow_failures: [{"php": "hhvm"}]
148
fast_finish: true
15-
install: composer install --prefer-dist --no-progress --no-interaction --ignore-platform-reqs
16-
script: "ls test/suite | xargs -I % sh -c 'echo; echo Testing %...; echo; phpunit --stop-on-failure test/suite/%'"
17-
sudo: false
9+
10+
env:
11+
global:
12+
- ARCHER_PUBLISH_VERSION=5.6
13+
- secure: "O3gWqnPXJHfHcaZscfK7RnHsLOChbPTMPd3Siw4pJBU4JluhJRto0S+EnOErce1cKLrD4zHdfPTEXEBLg8dFj2eOCbGDEuJHCguwow3UeeSQ6qnUNZOZlXIb2ajZRJtC4bB+CevyHqVYSUcGxcWmUu0faG26/xh8cHpXK3Daris="
14+
15+
install:
16+
- ./.archer/travis.install
17+
18+
script:
19+
- ./vendor/bin/archer travis:build

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Phony changelog
22

3+
## 0.5.2 (2015-11-05)
4+
5+
- **[FIXED]** Fixed stripping of exception xdebug message in exporter and equal
6+
to matcher ([#87]).
7+
- **[DOCUMENTATION]** Added documentation.
8+
9+
[#87]: https://github.com/eloquent/phony/pull/87
10+
311
## 0.5.1 (2015-10-22)
412

513
- **[IMPROVED]** Prevent exporter and matcher from traversing into mock

CONTRIBUTING.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@ As a guideline, please follow this process:
2626

2727
## Tests
2828

29-
- Run the tests with `vendor/bin/phpunit path/to/tests`, or simply
30-
`vendor/bin/phpunit` to run the entire suite.
31-
- Generate a coverage report with
32-
`vendor/bin/phpunit -c phpunit.coverage.xml path/to/tests`, or simply
33-
`vendor/bin/phpunit -c phpunit.coverage.xml` to generate coverage for the
34-
entire suite. The coverage report will be created at
35-
`artifacts/tests/coverage/index.html`.
29+
- Run the tests with `vendor/bin/archer t path/to/tests`, or simply
30+
`vendor/bin/archer` to run the entire suite.
31+
- Generate a coverage report with `vendor/bin/archer c path/to/tests`, or simply
32+
`vendor/bin/archer c` to generate coverage for the entire suite. The coverage
33+
report will be created at `artifacts/tests/coverage/index.html`.
3634
- Run the integration tests with `test/integration/run-all`. Each test suite has
3735
one passing, and one failing test. This demonstrates *Phony*'s output.
3836
- Run the benchmarks with `vendor/bin/athletic -p test/benchmarks`. This

README.md

Lines changed: 109 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
*Mocks, stubs, and spies for PHP.*
44

5-
[![The most recent stable version is 0.5.1][version-image]][semantic versioning]
5+
[![The most recent stable version is 0.5.2][version-image]][semantic versioning]
66
[![Current build status image][build-image]][current build status]
77
[![Current coverage status image][coverage-image]][current coverage status]
88

@@ -11,19 +11,121 @@
1111
[coverage-image]: https://img.shields.io/codecov/c/github/eloquent/phony/develop.svg?style=flat-square "Current test coverage for the develop branch"
1212
[current coverage status]: https://codecov.io/github/eloquent/phony
1313
[semantic versioning]: http://semver.org/
14-
[version-image]: http://img.shields.io/:semver-0.5.1-yellow.svg?style=flat-square "This project uses semantic versioning"
14+
[version-image]: http://img.shields.io/:semver-0.5.2-yellow.svg?style=flat-square "This project uses semantic versioning"
1515

1616
## Installation and documentation
1717

1818
- Available as [Composer] package [eloquent/phony].
19+
- Read the [manual].
20+
- Read the [API documentation].
1921

22+
[api documentation]: http://lqnt.co/phony/artifacts/documentation/api/
2023
[composer]: http://getcomposer.org/
2124
[eloquent/phony]: https://packagist.org/packages/eloquent/phony
2225

23-
## Here be dragons
26+
## What is *Phony*?
2427

25-
Documentation is coming, you can see [progress on the feature/docs branch]. Also
26-
check out the [functional tests] for working examples.
28+
*Phony* is a PHP library for creating [test doubles]. *Phony* has first-class
29+
support for many modern PHP features such as [traits] and [generators], and
30+
supports PHP 7 and [HHVM].
2731

28-
[functional tests]: test/suite/FunctionalTest.php
29-
[progress on the feature/docs branch]: https://github.com/eloquent/phony/blob/feature/docs/doc/index.md
32+
[generators]: http://php.net/language.generators.overview
33+
[hhvm]: http://hhvm.com/
34+
[test doubles]: https://en.wikipedia.org/wiki/Test_double
35+
[traits]: http://php.net/traits
36+
37+
## Usage
38+
39+
For detailed usage, see the [manual].
40+
41+
### Standalone usage
42+
43+
```php
44+
use function Eloquent\Phony\mock;
45+
46+
$handle = mock('ClassA');
47+
$handle->methodA('argument')->returns('value');
48+
49+
$mock = $handle->mock();
50+
51+
assert($mock->methodA('argument') === 'value');
52+
$handle->methodA->calledWith('argument');
53+
```
54+
55+
### Peridot usage
56+
57+
```php
58+
use function Eloquent\Phony\mock;
59+
60+
describe('Phony', function () {
61+
it('integrates with Peridot', function () {
62+
$handle = mock('ClassA');
63+
$handle->methodA('argument')->returns('value');
64+
65+
$mock = $handle->mock();
66+
67+
expect($mock->methodA('argument'))->to->equal('value');
68+
$handle->methodA->calledWith('argument');
69+
});
70+
});
71+
```
72+
73+
### Pho usage
74+
75+
```php
76+
use function Eloquent\Phony\Pho\mock;
77+
78+
describe('Phony', function () {
79+
it('integrates with Pho', function () {
80+
$handle = mock('ClassA');
81+
$handle->methodA('argument')->returns('value');
82+
83+
$mock = $handle->mock();
84+
85+
expect($mock->methodA('argument'))->toBe('value');
86+
$handle->methodA->calledWith('argument');
87+
});
88+
});
89+
```
90+
91+
### PHPUnit usage
92+
93+
```php
94+
use Eloquent\Phony\Phpunit\Phony;
95+
96+
class PhonyTest extends PHPUnit_Framework_TestCase
97+
{
98+
public function testIntegration()
99+
{
100+
$handle = Phony::mock('ClassA');
101+
$handle->methodA('argument')->returns('value');
102+
103+
$mock = $handle->mock();
104+
105+
$this->assertSame('value', $mock->methodA('argument'));
106+
$handle->methodA->calledWith('argument');
107+
}
108+
}
109+
```
110+
111+
### SimpleTest usage
112+
113+
```php
114+
use Eloquent\Phony\Simpletest\Phony;
115+
116+
class PhonyTest extends UnitTestCase
117+
{
118+
public function testIntegration()
119+
{
120+
$handle = Phony::mock('ClassA');
121+
$handle->methodA('argument')->returns('value');
122+
123+
$mock = $handle->mock();
124+
125+
$this->assertSame($mock->methodA('argument'), 'value');
126+
$handle->methodA->calledWith('argument');
127+
}
128+
}
129+
```
130+
131+
[manual]: doc/index.md

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
"danielstjules/pho": "^1",
2121
"eloquent/asplode": "^2",
2222
"hamcrest/hamcrest-php": "^1",
23+
"icecave/archer": "dev-develop",
2324
"icecave/isolator": "^3",
2425
"mockery/mockery": "^0",
26+
"peridot-php/leo": "^1",
2527
"peridot-php/peridot": "^1",
2628
"phake/phake": "^2",
2729
"phpspec/prophecy": "^1",
30+
"phpunit/php-code-coverage": "^2",
2831
"phpunit/phpunit": "^4",
32+
"sami/sami": "^2",
2933
"sebastian/comparator": "^1",
3034
"simpletest/simpletest": "dev-master"
3135
},

0 commit comments

Comments
 (0)