Skip to content

Commit

Permalink
Closes #5033
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Aug 22, 2022
1 parent 3d93879 commit 5b351a5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .psalm/baseline.xml
Expand Up @@ -905,7 +905,7 @@
<code>getResult</code>
<code>runTest</code>
</MissingReturnType>
<MissingThrowsDocblock occurrences="17">
<MissingThrowsDocblock occurrences="18">
<code>endTest</code>
<code>endTest</code>
<code>endTest</code>
Expand All @@ -919,6 +919,7 @@
<code>getMockForTrait</code>
<code>getObjectForTrait</code>
<code>new Differ($header)</code>
<code>throw new Exception('This test uses TestCase::prophesize(), but phpspec/prophecy is not installed. Please run "composer require --dev phpspec/prophecy".');</code>
</MissingThrowsDocblock>
<PossiblyNullPropertyAssignmentValue occurrences="4">
<code>$beStrictAboutChangesToGlobalState</code>
Expand Down
7 changes: 7 additions & 0 deletions ChangeLog-8.5.md
Expand Up @@ -2,6 +2,12 @@

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

## [8.5.29] - 2022-MM-DD

### Changed

* [#5033](https://github.com/sebastianbergmann/phpunit/issues/5033): Do not depend on phpspec/prophecy

## [8.5.28] - 2022-07-29

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

[8.5.29]: https://github.com/sebastianbergmann/phpunit/compare/8.5.28...8.5
[8.5.28]: https://github.com/sebastianbergmann/phpunit/compare/8.5.27...8.5.28
[8.5.27]: https://github.com/sebastianbergmann/phpunit/compare/8.5.26...8.5.27
[8.5.26]: https://github.com/sebastianbergmann/phpunit/compare/8.5.25...8.5.26
Expand Down
30 changes: 29 additions & 1 deletion build.xml
Expand Up @@ -124,7 +124,30 @@
</antcall>
</target>

<target name="-phar-prepare" depends="clean,install-dependencies">
<target name="-phar-prepare" depends="clean">
<copy file="${basedir}/composer.json" tofile="${basedir}/build/tmp/composer.json"/>

<exec executable="${basedir}/tools/composer" taskname="composer">
<arg value="require"/>
<arg value="--no-update"/>
<arg value="phpunit/php-invoker:^2.0"/>
</exec>

<exec executable="${basedir}/tools/composer" taskname="composer">
<arg value="require"/>
<arg value="--no-update"/>
<arg value="phpspec/prophecy:^1.10.3"/>
</exec>

<exec executable="${basedir}/tools/composer" taskname="composer">
<arg value="update"/>
<arg value="--no-interaction"/>
<arg value="--no-progress"/>
<arg value="--no-ansi"/>
</exec>

<move file="${basedir}/build/tmp/composer.json" tofile="${basedir}/composer.json"/>

<mkdir dir="${basedir}/build/artifacts"/>
<mkdir dir="${basedir}/build/tmp/phar"/>
<mkdir dir="${basedir}/build/tmp/phar-scoped"/>
Expand Down Expand Up @@ -330,6 +353,11 @@
<include name="**/*.php" />
</fileset>
</copy>

<exec executable="${basedir}/tools/composer" taskname="composer">
<arg value="remove"/>
<arg value="phpspec/prophecy"/>
</exec>
</target>

<target name="-phar-build" depends="-phar-determine-version">
Expand Down
1 change: 0 additions & 1 deletion composer.json
Expand Up @@ -32,7 +32,6 @@
"myclabs/deep-copy": "^1.10.0",
"phar-io/manifest": "^2.0.3",
"phar-io/version": "^3.0.2",
"phpspec/prophecy": "^1.10.3",
"phpunit/php-code-coverage": "^7.0.12",
"phpunit/php-file-iterator": "^2.0.4",
"phpunit/php-text-template": "^1.2.1",
Expand Down
4 changes: 4 additions & 0 deletions src/Framework/TestCase.php
Expand Up @@ -1953,6 +1953,10 @@ protected function getObjectForTrait($traitName, array $arguments = [], $traitCl
*/
protected function prophesize($classOrInterface = null): ObjectProphecy
{
if (!class_exists(Prophet::class)) {
throw new Exception('This test uses TestCase::prophesize(), but phpspec/prophecy is not installed. Please run "composer require --dev phpspec/prophecy".');
}

if (is_string($classOrInterface)) {
$this->recordDoubledType($classOrInterface);
}
Expand Down

0 comments on commit 5b351a5

Please sign in to comment.