Skip to content

Commit 515d9e6

Browse files
committed
Merge remote-tracking branch 'origin/master' into hotfix/double-mock
2 parents d20dffe + 291569e commit 515d9e6

15 files changed

+176
-69
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: "Check Coding Standards"
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
coding-standards:
9+
name: "Check Coding Standards"
10+
11+
runs-on: "ubuntu-latest"
12+
13+
steps:
14+
- name: "Checkout"
15+
uses: "actions/checkout@v2"
16+
17+
- name: "Setup PHP"
18+
uses: "shivammathur/setup-php@v2"
19+
with:
20+
php-version: "7.4"
21+
tools: composer:v2, cs2pr
22+
23+
- name: "Install dependencies"
24+
run: "composer install --no-interaction --no-progress --no-suggest"
25+
26+
- name: "Run phpcs"
27+
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr

.github/workflows/phpmd.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: "Check phpmd"
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
coding-standards:
9+
name: "Check phpmd"
10+
11+
runs-on: "ubuntu-latest"
12+
13+
steps:
14+
- name: "Checkout"
15+
uses: "actions/checkout@v2"
16+
17+
- name: "Setup PHP"
18+
uses: "shivammathur/setup-php@v2"
19+
with:
20+
php-version: "7.4"
21+
tools: composer:v2
22+
23+
- name: "Install dependencies"
24+
run: "composer require phpmd/phpmd --no-interaction --no-progress --no-suggest"
25+
26+
- name: "Run phpmd"
27+
run: vendor/bin/phpmd classes/ text cleancode,codesize,controversial,design,naming,unusedcode

.github/workflows/phpunit.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "PHPUnit tests"
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
phpunit:
9+
name: PHPUnit tests on PHP ${{ matrix.php-version }}
10+
11+
runs-on: "ubuntu-latest"
12+
13+
strategy:
14+
matrix:
15+
php-version:
16+
- "7.2"
17+
- "7.3"
18+
- "7.4"
19+
- "8.0"
20+
21+
steps:
22+
- name: "Checkout"
23+
uses: "actions/checkout@v2"
24+
25+
- name: "Install PHP"
26+
uses: "shivammathur/setup-php@v2"
27+
with:
28+
coverage: "pcov"
29+
php-version: "${{ matrix.php-version }}"
30+
ini-values: memory_limit=-1
31+
tools: composer:v2
32+
33+
- name: "Cache dependencies"
34+
uses: "actions/cache@v2"
35+
with:
36+
path: |
37+
~/.composer/cache
38+
vendor
39+
key: "php-${{ matrix.php-version }}"
40+
restore-keys: "php-${{ matrix.php-version }}"
41+
42+
- name: "Install dependencies"
43+
run: "composer install --no-interaction --no-progress --no-suggest"
44+
45+
- name: "Tests"
46+
run: vendor/bin/phpunit

.github/workflows/test-flight.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Check test-flight"
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
coding-standards:
9+
name: "Check test-flight"
10+
11+
runs-on: "ubuntu-latest"
12+
13+
steps:
14+
- name: "Checkout"
15+
uses: "actions/checkout@v2"
16+
17+
- name: "Setup PHP"
18+
uses: "shivammathur/setup-php@v2"
19+
with:
20+
php-version: "7.4"
21+
tools: composer:v2
22+
ini-values: "zend.assertions=1"
23+
24+
- name: "Install dependencies"
25+
run: "composer require cundd/test-flight --no-interaction --no-progress --no-suggest"
26+
27+
- name: "Run test-flight"
28+
run: |
29+
vendor/bin/test-flight README.md
30+
vendor/bin/test-flight classes/

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.phpunit.result.cache
2+
/composer.lock
3+
/vendor/

.travis.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,3 @@ Responsable for this project is Markus Malkusch [email protected].
6161

6262
If you like this project and feel generous donate a few Bitcoins here:
6363
[1335STSwu9hST4vcMRppEPgENMHD2r1REK](bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK)
64-
65-
[![Build Status](https://travis-ci.org/php-mock/php-mock-prophecy.svg?branch=master)](https://travis-ci.org/php-mock/php-mock-prophecy)

classes/FunctionProphecy.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@
1717
*/
1818
final class FunctionProphecy implements ProphecyInterface
1919
{
20-
20+
2121
/**
2222
* @var Prophet The prophet.
2323
*/
2424
private $prophet;
25-
25+
2626
/**
2727
* @var string The namespace.
2828
*/
2929
private $namespace;
30-
30+
3131
/**
3232
* @var Revelation[] The delegated prophecies.
3333
*/
3434
private $revelations = [];
35-
35+
3636
/**
3737
* Sets the prophet.
3838
*
@@ -44,7 +44,7 @@ public function __construct($namespace, Prophet $prophet)
4444
$this->prophet = $prophet;
4545
$this->namespace = $namespace;
4646
}
47-
47+
4848
/**
4949
* Creates a new function prophecy using the specified function name
5050
* and arguments.
@@ -74,7 +74,7 @@ public function __call($functionName, array $arguments)
7474

7575
return $prophecy->__call(MockDelegateFunctionBuilder::METHOD, $arguments);
7676
}
77-
77+
7878
/**
7979
* Reveals the function prophecies.
8080
*

classes/PHPProphet.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Prophecy\Prophet;
88
use Prophecy\Prophecy\ProphecyInterface;
99
use Prophecy\Exception\Prediction\AggregateException;
10+
use ReflectionProperty;
1011

1112
/**
1213
* A Prophet for built-in PHP functions.
@@ -38,7 +39,7 @@ final class PHPProphet
3839
* @var Prophet The prophet.
3940
*/
4041
private $prophet;
41-
42+
4243
/**
4344
* Builds the prophet.
4445
*
@@ -49,12 +50,12 @@ public function __construct(Prophet $prophet = null)
4950
if (is_null($prophet)) {
5051
$prophet = new Prophet();
5152
}
52-
53+
5354
$revealer = new ReferencePreservingRevealer(self::getProperty($prophet, "revealer"));
5455
$util = self::getProperty($prophet, "util");
5556
$this->prophet = new Prophet($prophet->getDoubler(), $revealer, $util);
5657
}
57-
58+
5859
/**
5960
* Creates a new function prophecy for a given namespace.
6061
*
@@ -66,7 +67,7 @@ public function prophesize($namespace)
6667
{
6768
return new FunctionProphecy($namespace, $this->prophet);
6869
}
69-
70+
7071
/**
7172
* Checks all predictions defined by prophecies of this Prophet.
7273
*
@@ -80,7 +81,7 @@ public function checkPredictions()
8081
Mock::disableAll();
8182
$this->prophet->checkPredictions();
8283
}
83-
84+
8485
/**
8586
* Defines the function prophecy in the given namespace.
8687
*
@@ -109,7 +110,7 @@ public static function define($namespace, $name)
109110
->build()
110111
->define();
111112
}
112-
113+
113114
/**
114115
* Returns a private property of a prophet.
115116
*
@@ -120,7 +121,7 @@ public static function define($namespace, $name)
120121
*/
121122
private static function getProperty(Prophet $prophet, $property)
122123
{
123-
$reflection = new \ReflectionProperty($prophet, $property);
124+
$reflection = new ReflectionProperty($prophet, $property);
124125
$reflection->setAccessible(true);
125126
return $reflection->getValue($prophet);
126127
}

classes/ReferencePreservingRevealer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
*/
1616
final class ReferencePreservingRevealer implements RevealerInterface
1717
{
18-
18+
1919
/**
2020
* @var RevealerInterface The subject.
2121
*/
2222
private $revealer;
23-
23+
2424
/**
2525
* Sets the subject.
2626
*

0 commit comments

Comments
 (0)