Skip to content

Commit 4b1edef

Browse files
Merge branch '9.5'
2 parents dcd2797 + 30bb652 commit 4b1edef

File tree

4 files changed

+44
-91
lines changed

4 files changed

+44
-91
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,8 @@ jobs:
255255
with:
256256
java-version: 1.8
257257

258-
- name: Run regular test suite with unscoped PHAR
259-
run: ant run-regular-tests-with-unscoped-phar
260-
261-
- name: Run PHAR-specific end-to-end tests with scoped PHAR
262-
run: ant run-phar-specific-tests-with-scoped-phar
258+
- name: Run PHAR-specific end-to-end tests
259+
run: ant run-phar-specific-tests
263260

264261
- uses: actions/upload-artifact@v2
265262
if: ${{ matrix.php-version == 8.1 }}

build.xml

Lines changed: 23 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -96,28 +96,12 @@
9696
<target name="phar" depends="-phar-prepare,-phar-determine-version" description="Create PHAR archive of PHPUnit and all its dependencies">
9797
<antcall target="-phar-build">
9898
<param name="type" value="release"/>
99-
<param name="scope" value="true"/>
100-
</antcall>
101-
</target>
102-
103-
<target name="unscoped-phar" depends="-phar-prepare,-phar-determine-version" description="Create unscoped PHAR archive of PHPUnit and all its dependencies">
104-
<antcall target="-phar-build">
105-
<param name="type" value="release"/>
106-
<param name="scope" value="false"/>
10799
</antcall>
108100
</target>
109101

110102
<target name="phar-snapshot" depends="-phar-prepare" description="Create PHAR archive of PHPUnit and all its dependencies (snapshot)">
111103
<antcall target="-phar-build">
112104
<param name="type" value="snapshot"/>
113-
<param name="scope" value="true"/>
114-
</antcall>
115-
</target>
116-
117-
<target name="unscoped-phar-snapshot" depends="-phar-prepare" description="Create unscoped PHAR archive of PHPUnit and all its dependencies (snapshot)">
118-
<antcall target="-phar-build">
119-
<param name="type" value="snapshot"/>
120-
<param name="scope" value="false"/>
121105
</antcall>
122106
</target>
123107

@@ -330,12 +314,28 @@
330314
<arg value="${type}"/>
331315
</exec>
332316

333-
<antcall target="-phar-scope" if:true="${scope}"/>
334-
<copy todir="${basedir}/build/tmp/phar-scoped" unless:true="${scope}">
335-
<fileset dir="${basedir}/build/tmp/phar">
336-
<include name="**/*" />
337-
</fileset>
338-
</copy>
317+
<exec executable="${basedir}/tools/php-scoper" taskname="php-scoper">
318+
<arg value="add-prefix" />
319+
<arg value="--no-ansi" />
320+
<arg value="--force" />
321+
<arg value="--config" />
322+
<arg path="${basedir}/build/config/php-scoper.php" />
323+
<arg value="--no-interaction" />
324+
<arg value="--stop-on-failure" />
325+
<arg value="--output-dir" />
326+
<arg path="${basedir}/build/tmp/phar-scoped" />
327+
<arg value="--prefix" />
328+
<arg value="PHPUnit" />
329+
<arg path="${basedir}/build/tmp/phar" />
330+
</exec>
331+
332+
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/PhptTestCase.tpl" token="SebastianBergmann\CodeCoverage\CodeCoverage" value="PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage"/>
333+
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/PhptTestCase.tpl" token="SebastianBergmann\CodeCoverage\Driver\Selector" value="PHPUnit\SebastianBergmann\CodeCoverage\Driver\Selector"/>
334+
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/PhptTestCase.tpl" token="SebastianBergmann\CodeCoverage\Filter" value="PHPUnit\SebastianBergmann\CodeCoverage\Filter"/>
335+
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/TestCaseClass.tpl" token="SebastianBergmann\CodeCoverage\CodeCoverage" value="PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage"/>
336+
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/TestCaseClass.tpl" token="SebastianBergmann\CodeCoverage\Driver\Selector" value="PHPUnit\SebastianBergmann\CodeCoverage\Driver\Selector"/>
337+
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/TestCaseMethod.tpl" token="SebastianBergmann\CodeCoverage\CodeCoverage" value="PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage"/>
338+
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/TestCaseMethod.tpl" token="SebastianBergmann\CodeCoverage\Driver\Selector" value="PHPUnit\SebastianBergmann\CodeCoverage\Driver\Selector"/>
339339

340340
<copy file="${basedir}/.phpstorm.meta.php" tofile="${basedir}/build/tmp/phar-scoped/.phpstorm.meta.php"/>
341341

@@ -372,57 +372,11 @@
372372
<delete dir="${basedir}/build/tmp"/>
373373
</target>
374374

375-
<target name="-phar-scope">
376-
<exec executable="${basedir}/tools/php-scoper" taskname="php-scoper">
377-
<arg value="add-prefix" />
378-
<arg value="--no-ansi" />
379-
<arg value="--force" />
380-
<arg value="--config" />
381-
<arg path="${basedir}/build/config/php-scoper.php" />
382-
<arg value="--no-interaction" />
383-
<arg value="--stop-on-failure" />
384-
<arg value="--output-dir" />
385-
<arg path="${basedir}/build/tmp/phar-scoped" />
386-
<arg value="--prefix" />
387-
<arg value="PHPUnit" />
388-
<arg path="${basedir}/build/tmp/phar" />
389-
</exec>
390-
391-
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/PhptTestCase.tpl" token="SebastianBergmann\CodeCoverage\CodeCoverage" value="PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage"/>
392-
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/PhptTestCase.tpl" token="SebastianBergmann\CodeCoverage\Driver\Selector" value="PHPUnit\SebastianBergmann\CodeCoverage\Driver\Selector"/>
393-
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/PhptTestCase.tpl" token="SebastianBergmann\CodeCoverage\Filter" value="PHPUnit\SebastianBergmann\CodeCoverage\Filter"/>
394-
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/TestCaseClass.tpl" token="SebastianBergmann\CodeCoverage\CodeCoverage" value="PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage"/>
395-
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/TestCaseClass.tpl" token="SebastianBergmann\CodeCoverage\Driver\Selector" value="PHPUnit\SebastianBergmann\CodeCoverage\Driver\Selector"/>
396-
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/TestCaseMethod.tpl" token="SebastianBergmann\CodeCoverage\CodeCoverage" value="PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage"/>
397-
<replace file="${basedir}/build/tmp/phar-scoped/phpunit/Util/PHP/Template/TestCaseMethod.tpl" token="SebastianBergmann\CodeCoverage\Driver\Selector" value="PHPUnit\SebastianBergmann\CodeCoverage\Driver\Selector"/>
398-
</target>
399-
400375
<target name="-phar-determine-version">
401376
<exec executable="${basedir}/build/scripts/version.php" outputproperty="version" failonerror="true" />
402377
</target>
403378

404-
<target name="run-regular-tests-with-unscoped-phar" depends="clean,unscoped-phar-snapshot" description="Build unscoped PHAR snapshot and run the regular test suite with it">
405-
<exec executable="${basedir}/tools/phpab" taskname="phpab" failonerror="true">
406-
<arg value="--output" />
407-
<arg path="${basedir}/tests/autoload.php" />
408-
<arg path="${basedir}/tests/_files" />
409-
<arg path="${basedir}/tests/end-to-end/_files" />
410-
<arg path="${basedir}/tests/end-to-end/execution-order/_files" />
411-
<arg path="${basedir}/tests/unit" />
412-
</exec>
413-
414-
<delete dir="${basedir}/vendor"/>
415-
<delete file="${basedir}/composer.lock"/>
416-
417-
<exec executable="${basedir}/build/artifacts/phpunit-snapshot.phar" taskname="phpunit" failonerror="true">
418-
<arg value="--testsuite" />
419-
<arg value="unit" />
420-
</exec>
421-
422-
<delete file="${basedir}/tests/autoload.php"/>
423-
</target>
424-
425-
<target name="run-phar-specific-tests-with-scoped-phar" depends="clean,phar-snapshot" description="Build scoped PHAR snapshot and run the PHAR-specific tests with it">
379+
<target name="run-phar-specific-tests" depends="clean,phar-snapshot" description="Build snapshot PHAR and run the PHAR-specific tests with it">
426380
<delete dir="${basedir}/vendor"/>
427381
<delete file="${basedir}/composer.lock"/>
428382

tests/unit/Framework/MockObject/Builder/InvocationMockerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*/
11+
namespace PHPUnit\Framework\MockObject;
12+
13+
use Foo;
1114
use PHPUnit\Framework\Attributes\CoversClass;
1215
use PHPUnit\Framework\Attributes\Small;
1316
use PHPUnit\Framework\Constraint\IsEqual;
1417
use PHPUnit\Framework\MockObject\Builder\InvocationMocker;
15-
use PHPUnit\Framework\MockObject\IncompatibleReturnValueException;
16-
use PHPUnit\Framework\MockObject\InvocationHandler;
17-
use PHPUnit\Framework\MockObject\Matcher;
18-
use PHPUnit\Framework\MockObject\MethodCannotBeConfiguredException;
1918
use PHPUnit\Framework\MockObject\Stub\ReturnSelf;
2019
use PHPUnit\Framework\MockObject\Stub\ReturnStub;
2120
use PHPUnit\Framework\TestCase;
2221
use PHPUnit\TestFixture\MockObject\ClassWithAllPossibleReturnTypes;
2322
use PHPUnit\TestFixture\MockObject\ClassWithImplicitProtocol;
23+
use stdClass;
2424

2525
#[CoversClass(InvocationMocker::class)]
2626
#[Small]

tests/unit/Framework/MockObject/ProxyObjectTest.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10+
namespace PHPUnit\Framework\MockObject;
11+
12+
use function assert;
1013
use PHPUnit\Framework\Attributes\Small;
11-
use PHPUnit\Framework\MockObject\MockObject;
1214
use PHPUnit\Framework\TestCase;
1315
use PHPUnit\TestFixture\MockObject\TestProxyFixture;
1416

@@ -22,8 +24,8 @@ public function testProxyingWorksForMethodThatReturnsUndeclaredScalarValue(): vo
2224
$proxy->expects($this->once())
2325
->method('returnString');
2426

25-
\assert($proxy instanceof MockObject);
26-
\assert($proxy instanceof TestProxyFixture);
27+
assert($proxy instanceof MockObject);
28+
assert($proxy instanceof TestProxyFixture);
2729

2830
$this->assertSame('result', $proxy->returnString());
2931
}
@@ -35,8 +37,8 @@ public function testProxyingWorksForMethodThatReturnsDeclaredScalarValue(): void
3537
$proxy->expects($this->once())
3638
->method('returnTypedString');
3739

38-
\assert($proxy instanceof MockObject);
39-
\assert($proxy instanceof TestProxyFixture);
40+
assert($proxy instanceof MockObject);
41+
assert($proxy instanceof TestProxyFixture);
4042

4143
$this->assertSame('result', $proxy->returnTypedString());
4244
}
@@ -48,8 +50,8 @@ public function testProxyingWorksForMethodThatReturnsUndeclaredObject(): void
4850
$proxy->expects($this->once())
4951
->method('returnObject');
5052

51-
\assert($proxy instanceof MockObject);
52-
\assert($proxy instanceof TestProxyFixture);
53+
assert($proxy instanceof MockObject);
54+
assert($proxy instanceof TestProxyFixture);
5355

5456
$this->assertSame('bar', $proxy->returnObject()->foo);
5557
}
@@ -61,8 +63,8 @@ public function testProxyingWorksForMethodThatReturnsDeclaredObject(): void
6163
$proxy->expects($this->once())
6264
->method('returnTypedObject');
6365

64-
\assert($proxy instanceof MockObject);
65-
\assert($proxy instanceof TestProxyFixture);
66+
assert($proxy instanceof MockObject);
67+
assert($proxy instanceof TestProxyFixture);
6668

6769
$this->assertSame('bar', $proxy->returnTypedObject()->foo);
6870
}
@@ -74,8 +76,8 @@ public function testProxyingWorksForMethodThatReturnsUndeclaredObjectOfFinalClas
7476
$proxy->expects($this->once())
7577
->method('returnObjectOfFinalClass');
7678

77-
\assert($proxy instanceof MockObject);
78-
\assert($proxy instanceof TestProxyFixture);
79+
assert($proxy instanceof MockObject);
80+
assert($proxy instanceof TestProxyFixture);
7981

8082
$this->assertSame('value', $proxy->returnObjectOfFinalClass()->value());
8183
}
@@ -87,8 +89,8 @@ public function testProxyingWorksForMethodThatReturnsDeclaredObjectOfFinalClass(
8789
$proxy->expects($this->once())
8890
->method('returnTypedObjectOfFinalClass');
8991

90-
\assert($proxy instanceof MockObject);
91-
\assert($proxy instanceof TestProxyFixture);
92+
assert($proxy instanceof MockObject);
93+
assert($proxy instanceof TestProxyFixture);
9294

9395
$this->assertSame('value', $proxy->returnTypedObjectOfFinalClass()->value());
9496
}

0 commit comments

Comments
 (0)