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

Commit 8891e6d

Browse files
committed
Reintroduced integration tests.
1 parent c55a03f commit 8891e6d

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ As a guideline, please follow this process when contributing:
1111
`coverage/index.html`.
1212
- Fix code style issues with `make lint`, but be sure to stage changes
1313
first.
14+
- Run the integration tests with `make integration`. There should be one
15+
passing test, and one failing test. This demonstrates *Phony*'s output.
1416
5. [Squash] commits if necessary (`git rebase -i master`).
1517
6. Submit a pull request to the **master** branch.
1618

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ coverage: install
77
phpdbg -qrr vendor/bin/phpunit
88

99
open-coverage:
10-
open coverage/index.html
10+
open coverage/index.
11+
12+
integration: install
13+
test/integration/run
1114

1215
lint: test/bin/php-cs-fixer
1316
test/bin/php-cs-fixer fix --using-cache no
1417

1518
install:
1619
composer install
1720

18-
.PHONY: test coverage open-coverage lint install
21+
.PHONY: test coverage open-coverage integration lint install
1922

2023
test/bin/php-cs-fixer:
2124
mkdir -p test/bin

test/integration/PhonyTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Phony package.
5+
*
6+
* Copyright © 2016 Erin Millard
7+
*
8+
* For the full copyright and license information, please view the LICENSE file
9+
* that was distributed with this source code.
10+
*/
11+
12+
use Eloquent\Phony\Phpunit\Phony;
13+
14+
class PhonyTest extends PHPUnit_Framework_TestCase
15+
{
16+
protected function setUp()
17+
{
18+
$this->handle = Phony::mock('Eloquent\Phony\Phpunit\Test\TestClassA');
19+
$this->mock = $this->handle->get();
20+
}
21+
22+
public function testShouldRecordPassingMockAssertions()
23+
{
24+
$this->mock->testClassAMethodA('aardvark', 'bonobo');
25+
26+
$this->handle->testClassAMethodA->calledWith('aardvark', 'bonobo');
27+
}
28+
29+
public function testShouldRecordFailingMockAssertions()
30+
{
31+
$this->mock->testClassAMethodA('aardvark', array('bonobo', 'capybara', 'dugong'));
32+
$this->mock->testClassAMethodA('armadillo', array('bonobo', 'chameleon', 'dormouse'));
33+
34+
$this->handle->testClassAMethodA->calledWith('aardvark', array('bonobo', 'chameleon', 'dugong'));
35+
}
36+
}

test/integration/run

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
echo
4+
echo ===========================================================================
5+
echo PHPUnit
6+
echo ===========================================================================
7+
echo
8+
9+
vendor/bin/phpunit test/integration

0 commit comments

Comments
 (0)