Skip to content

Commit 5b351a5

Browse files
Closes #5033
1 parent 3d93879 commit 5b351a5

File tree

5 files changed

+42
-3
lines changed

5 files changed

+42
-3
lines changed

.psalm/baseline.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@
905905
<code>getResult</code>
906906
<code>runTest</code>
907907
</MissingReturnType>
908-
<MissingThrowsDocblock occurrences="17">
908+
<MissingThrowsDocblock occurrences="18">
909909
<code>endTest</code>
910910
<code>endTest</code>
911911
<code>endTest</code>
@@ -919,6 +919,7 @@
919919
<code>getMockForTrait</code>
920920
<code>getObjectForTrait</code>
921921
<code>new Differ($header)</code>
922+
<code>throw new Exception('This test uses TestCase::prophesize(), but phpspec/prophecy is not installed. Please run "composer require --dev phpspec/prophecy".');</code>
922923
</MissingThrowsDocblock>
923924
<PossiblyNullPropertyAssignmentValue occurrences="4">
924925
<code>$beStrictAboutChangesToGlobalState</code>

ChangeLog-8.5.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes of the PHPUnit 8.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
44

5+
## [8.5.29] - 2022-MM-DD
6+
7+
### Changed
8+
9+
* [#5033](https://github.com/sebastianbergmann/phpunit/issues/5033): Do not depend on phpspec/prophecy
10+
511
## [8.5.28] - 2022-07-29
612

713
### Fixed
@@ -233,6 +239,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil
233239
* [#3967](https://github.com/sebastianbergmann/phpunit/issues/3967): Cannot double interface that extends interface that extends `\Throwable`
234240
* [#3968](https://github.com/sebastianbergmann/phpunit/pull/3968): Test class run in a separate PHP process are passing when `exit` called inside
235241

242+
[8.5.29]: https://github.com/sebastianbergmann/phpunit/compare/8.5.28...8.5
236243
[8.5.28]: https://github.com/sebastianbergmann/phpunit/compare/8.5.27...8.5.28
237244
[8.5.27]: https://github.com/sebastianbergmann/phpunit/compare/8.5.26...8.5.27
238245
[8.5.26]: https://github.com/sebastianbergmann/phpunit/compare/8.5.25...8.5.26

build.xml

+29-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,30 @@
124124
</antcall>
125125
</target>
126126

127-
<target name="-phar-prepare" depends="clean,install-dependencies">
127+
<target name="-phar-prepare" depends="clean">
128+
<copy file="${basedir}/composer.json" tofile="${basedir}/build/tmp/composer.json"/>
129+
130+
<exec executable="${basedir}/tools/composer" taskname="composer">
131+
<arg value="require"/>
132+
<arg value="--no-update"/>
133+
<arg value="phpunit/php-invoker:^2.0"/>
134+
</exec>
135+
136+
<exec executable="${basedir}/tools/composer" taskname="composer">
137+
<arg value="require"/>
138+
<arg value="--no-update"/>
139+
<arg value="phpspec/prophecy:^1.10.3"/>
140+
</exec>
141+
142+
<exec executable="${basedir}/tools/composer" taskname="composer">
143+
<arg value="update"/>
144+
<arg value="--no-interaction"/>
145+
<arg value="--no-progress"/>
146+
<arg value="--no-ansi"/>
147+
</exec>
148+
149+
<move file="${basedir}/build/tmp/composer.json" tofile="${basedir}/composer.json"/>
150+
128151
<mkdir dir="${basedir}/build/artifacts"/>
129152
<mkdir dir="${basedir}/build/tmp/phar"/>
130153
<mkdir dir="${basedir}/build/tmp/phar-scoped"/>
@@ -330,6 +353,11 @@
330353
<include name="**/*.php" />
331354
</fileset>
332355
</copy>
356+
357+
<exec executable="${basedir}/tools/composer" taskname="composer">
358+
<arg value="remove"/>
359+
<arg value="phpspec/prophecy"/>
360+
</exec>
333361
</target>
334362

335363
<target name="-phar-build" depends="-phar-determine-version">

composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"myclabs/deep-copy": "^1.10.0",
3333
"phar-io/manifest": "^2.0.3",
3434
"phar-io/version": "^3.0.2",
35-
"phpspec/prophecy": "^1.10.3",
3635
"phpunit/php-code-coverage": "^7.0.12",
3736
"phpunit/php-file-iterator": "^2.0.4",
3837
"phpunit/php-text-template": "^1.2.1",

src/Framework/TestCase.php

+4
Original file line numberDiff line numberDiff line change
@@ -1953,6 +1953,10 @@ protected function getObjectForTrait($traitName, array $arguments = [], $traitCl
19531953
*/
19541954
protected function prophesize($classOrInterface = null): ObjectProphecy
19551955
{
1956+
if (!class_exists(Prophet::class)) {
1957+
throw new Exception('This test uses TestCase::prophesize(), but phpspec/prophecy is not installed. Please run "composer require --dev phpspec/prophecy".');
1958+
}
1959+
19561960
if (is_string($classOrInterface)) {
19571961
$this->recordDoubledType($classOrInterface);
19581962
}

0 commit comments

Comments
 (0)