Skip to content

Commit

Permalink
Closes #4142
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 4, 2020
1 parent 4303365 commit 0198607
Show file tree
Hide file tree
Showing 10 changed files with 5 additions and 224 deletions.
4 changes: 4 additions & 0 deletions ChangeLog-10.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ All notable changes of the PHPUnit 10.0 release series are documented in this fi

## [10.0.0] - 2021-02-05

### Removed

* [#4142](https://github.com/sebastianbergmann/phpunit/issues/4142): Remove Prophecy integration

[10.0.0]: https://github.com/sebastianbergmann/phpunit/compare/9.5...master
42 changes: 0 additions & 42 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -316,54 +316,12 @@
</fileset>
</copy>

<copy file="${basedir}/vendor/phpdocumentor/reflection-common/LICENSE" tofile="${basedir}/build/tmp/phar/phpdocumentor-reflection-common/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/phpdocumentor-reflection-common">
<fileset dir="${basedir}/vendor/phpdocumentor/reflection-common/src">
<include name="**/*.php" />
</fileset>
</copy>

<copy file="${basedir}/vendor/phpdocumentor/reflection-docblock/LICENSE" tofile="${basedir}/build/tmp/phar/phpdocumentor-reflection-docblock/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/phpdocumentor-reflection-docblock">
<fileset dir="${basedir}/vendor/phpdocumentor/reflection-docblock/src">
<include name="**/*.php" />
</fileset>
</copy>

<copy file="${basedir}/vendor/phpdocumentor/type-resolver/LICENSE" tofile="${basedir}/build/tmp/phar/phpdocumentor-type-resolver/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/phpdocumentor-type-resolver">
<fileset dir="${basedir}/vendor/phpdocumentor/type-resolver/src">
<include name="**/*.php" />
</fileset>
</copy>

<copy file="${basedir}/vendor/phpspec/prophecy/LICENSE" tofile="${basedir}/build/tmp/phar/phpspec-prophecy/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/phpspec-prophecy">
<fileset dir="${basedir}/vendor/phpspec/prophecy/src">
<include name="**/*.php" />
</fileset>
</copy>

<copy file="${basedir}/vendor/symfony/polyfill-ctype/LICENSE" tofile="${basedir}/build/tmp/phar/symfony-polyfill-ctype/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/symfony-polyfill-ctype">
<fileset dir="${basedir}/vendor/symfony/polyfill-ctype">
<include name="**/*.php" />
</fileset>
</copy>

<copy file="${basedir}/vendor/theseer/tokenizer/LICENSE" tofile="${basedir}/build/tmp/phar/theseer-tokenizer/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/theseer-tokenizer">
<fileset dir="${basedir}/vendor/theseer/tokenizer/src">
<include name="**/*.php" />
</fileset>
</copy>

<copy file="${basedir}/vendor/webmozart/assert/LICENSE" tofile="${basedir}/build/tmp/phar/webmozart-assert/LICENSE"/>
<copy todir="${basedir}/build/tmp/phar/webmozart-assert">
<fileset dir="${basedir}/vendor/webmozart/assert/src">
<include name="**/*.php" />
</fileset>
</copy>
</target>

<target name="-phar-build" depends="-phar-determine-version">
Expand Down
1 change: 0 additions & 1 deletion build/config/php-scoper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
return [
'whitelist' => [
'PHPUnit\*',
'Prophecy\*',
],
];
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"myclabs/deep-copy": "^1.10.1",
"phar-io/manifest": "^2.0.1",
"phar-io/version": "^3.0.2",
"phpspec/prophecy": "^1.12.1",
"phpunit/php-code-coverage": "^9.2.3",
"phpunit/php-file-iterator": "^3.0.5",
"phpunit/php-invoker": "^3.1.1",
Expand All @@ -51,8 +50,7 @@
"sebastian/version": "^3.0.2"
},
"require-dev": {
"ext-PDO": "*",
"phpspec/prophecy-phpunit": "^2.0.1"
"ext-PDO": "*"
},
"config": {
"platform": {
Expand Down
61 changes: 0 additions & 61 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@
use PHPUnit\Util\PHP\AbstractPhpProcess;
use PHPUnit\Util\Test as TestUtil;
use PHPUnit\Util\Type;
use Prophecy\Exception\Prediction\PredictionException;
use Prophecy\Prophecy\MethodProphecy;
use Prophecy\Prophecy\ObjectProphecy;
use Prophecy\Prophet;
use ReflectionClass;
use ReflectionException;
use SebastianBergmann\Comparator\Comparator;
Expand Down Expand Up @@ -309,11 +305,6 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
*/
private $snapshot;

/**
* @var \Prophecy\Prophet
*/
private $prophet;

/**
* @var bool
*/
Expand Down Expand Up @@ -1158,17 +1149,13 @@ public function runBare(): void
} catch (AssertionFailedError $e) {
$this->status = BaseTestRunner::STATUS_FAILURE;
$this->statusMessage = $e->getMessage();
} catch (PredictionException $e) {
$this->status = BaseTestRunner::STATUS_FAILURE;
$this->statusMessage = $e->getMessage();
} catch (Throwable $_e) {
$e = $_e;
$this->status = BaseTestRunner::STATUS_ERROR;
$this->statusMessage = $_e->getMessage();
}

$this->mockObjects = [];
$this->prophet = null;

// Tear down the fixture. An exception raised in tearDown() will be
// caught and passed on when no exception was raised before.
Expand Down Expand Up @@ -1226,10 +1213,6 @@ public function runBare(): void

// Workaround for missing "finally".
if (isset($e)) {
if ($e instanceof PredictionException) {
$e = new AssertionFailedError($e->getMessage());
}

$this->onNotSuccessfulTest($e);
}
}
Expand Down Expand Up @@ -1915,24 +1898,6 @@ protected function getObjectForTrait(string $traitName, array $arguments = [], s
);
}

/**
* @throws \Prophecy\Exception\Doubler\ClassNotFoundException
* @throws \Prophecy\Exception\Doubler\DoubleException
* @throws \Prophecy\Exception\Doubler\InterfaceNotFoundException
*
* @psalm-param class-string|null $classOrInterface
*/
protected function prophesize(?string $classOrInterface = null): ObjectProphecy
{
$this->addWarning('PHPUnit\Framework\TestCase::prophesize() is deprecated and will be removed in PHPUnit 10. Please use the trait provided by phpspec/prophecy-phpunit.');

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

return $this->getProphet()->prophesize($classOrInterface);
}

/**
* Creates a default TestResult object.
*
Expand Down Expand Up @@ -1990,21 +1955,6 @@ private function verifyMockObjects(): void
$this->shouldInvocationMockerBeReset($mockObject)
);
}

if ($this->prophet !== null) {
try {
$this->prophet->checkPredictions();
} finally {
foreach ($this->prophet->getProphecies() as $objectProphecy) {
foreach ($objectProphecy->getMethodProphecies() as $methodProphecies) {
foreach ($methodProphecies as $methodProphecy) {
/* @var MethodProphecy $methodProphecy */
$this->numAssertions += count($methodProphecy->getCheckedPredictions());
}
}
}
}
}
}

/**
Expand Down Expand Up @@ -2287,9 +2237,7 @@ private function createGlobalStateSnapshot(bool $backupGlobals): Snapshot
$excludeList->addClassNamePrefix('SebastianBergmann\Invoker');
$excludeList->addClassNamePrefix('SebastianBergmann\Template');
$excludeList->addClassNamePrefix('SebastianBergmann\Timer');
$excludeList->addClassNamePrefix('Symfony');
$excludeList->addClassNamePrefix('Doctrine\Instantiator');
$excludeList->addClassNamePrefix('Prophecy');
$excludeList->addStaticAttribute(ComparatorFactory::class, 'instance');

foreach ($this->backupStaticAttributesExcludeList as $class => $attributes) {
Expand Down Expand Up @@ -2374,15 +2322,6 @@ private function compareGlobalStateSnapshotPart(array $before, array $after, str
}
}

private function getProphet(): Prophet
{
if ($this->prophet === null) {
$this->prophet = new Prophet;
}

return $this->prophet;
}

/**
* @throws \SebastianBergmann\ObjectEnumerator\InvalidArgumentException
*/
Expand Down
24 changes: 0 additions & 24 deletions src/Util/ExcludeList.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@
use Doctrine\Instantiator\Instantiator;
use PharIo\Manifest\Manifest;
use PharIo\Version\Version as PharIoVersion;
use phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\Project;
use phpDocumentor\Reflection\Type;
use PhpParser\Parser;
use PHPUnit\Framework\TestCase;
use Prophecy\Prophet;
use ReflectionClass;
use ReflectionException;
use SebastianBergmann\CliParser\Parser as CliParser;
Expand All @@ -51,9 +47,7 @@
use SebastianBergmann\Timer\Timer;
use SebastianBergmann\Type\TypeName;
use SebastianBergmann\Version;
use Symfony\Polyfill\Ctype\Ctype;
use TheSeer\Tokenizer\Tokenizer;
use Webmozart\Assert\Assert;

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Expand Down Expand Up @@ -82,18 +76,6 @@ final class ExcludeList
// phar-io/version
PharIoVersion::class => 1,

// phpdocumentor/reflection-common
Project::class => 1,

// phpdocumentor/reflection-docblock
DocBlock::class => 1,

// phpdocumentor/type-resolver
Type::class => 1,

// phpspec/prophecy
Prophet::class => 1,

// phpunit/phpunit
TestCase::class => 2,

Expand Down Expand Up @@ -157,14 +139,8 @@ final class ExcludeList
// sebastian/version
Version::class => 1,

// symfony/polyfill-ctype
Ctype::class => 1,

// theseer/tokenizer
Tokenizer::class => 1,

// webmozart/assert
Assert::class => 1,
];

/**
Expand Down
28 changes: 0 additions & 28 deletions tests/_files/ExternalProphecyIntegrationTest.php

This file was deleted.

25 changes: 0 additions & 25 deletions tests/_files/InternalProphecyIntegrationTest.php

This file was deleted.

17 changes: 0 additions & 17 deletions tests/end-to-end/external-prophecy-integration-test.phpt

This file was deleted.

23 changes: 0 additions & 23 deletions tests/end-to-end/internal-prophecy-integration-test.phpt

This file was deleted.

0 comments on commit 0198607

Please sign in to comment.