Skip to content

Commit 829152c

Browse files
authored
Add e2e test to ensure the isolated finder exists (#364)
Closes #349
1 parent bf7271c commit 829152c

File tree

8 files changed

+40
-4
lines changed

8 files changed

+40
-4
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ env:
1010
global:
1111
secure: "1sVenz4DUy14AWE08s8V7Vz1D313t08R7axjBWI5R53BGNScm0lHlF/mONYEkdais5Mo9jkXwfzXIhqwqT6i9xltuIAIb1wUIwnQJCiACUGFWE4IP48ayD4KcjlExxoYHf2l98N0x/fc6ihwTa9pEHSH0cltr9wFJVbQD+lMC82V5gSVVzuteXjd7Dp/UFEgx3PcjRyvsrhySOE+qNInvOu3+ChPbFGE5Z18fncULJrEfVKpvOPBSYDDyI3A7KoHx/MrY9h3ow89S0jQw1AP1B5SVWKhIrFQT/d2oGeVPE382PSdnD5YiUNgcW85EHyFjt70oQyu1gxyIhRKygR+o02pDeanOJXp9wVsTo2yp6Nf/WWjniQenxxueM5MHfimMt1Khpx4ebiIuCOzIn6lhgQ1Aw6z3vVZelqk07zrIEycKJNWsto6a0X7H8McnJDyOlJ/PnbwXwsmcg29jDmNnKc6rGiQ08gK8BaZZfqhdtH8WxKxyUCuowprHslq614/W/4sLNophAOFSyOEFQl1Zqz3Ibe5EVPHbw5paxt9eY8W3gGajY8Bh1BYZOkXmkIgm4UFJHqslal/91Z4CIbLtCjGac0LWrvZaE5QFM8VRLmjgBWij5ajzFP5PI7S9JKJCETj8yrSRE51nAOPq1s1HmxdNQHmBa/xXQP8UahaRsM="
1212

13+
addons:
14+
apt:
15+
packages:
16+
- tree
17+
1318
matrix:
1419
include:
1520
- php: '7.3'

Makefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ tm: clover.xml
7474

7575
.PHONY: e2e
7676
e2e: ## Run end-to-end tests
77-
e2e: e2e_004 e2e_005 e2e_011 e2e_013 e2e_014 e2e_015 e2e_016 e2e_017 e2e_018 e2e_019 e2e_020 e2e_021 e2e_022 e2e_023 e2e_024 e2e_025 e2e_026 e2e_027 e2e_028 e2e_029 e2e_030 e2e_031
77+
e2e: e2e_004 e2e_005 e2e_011 e2e_013 e2e_014 e2e_015 e2e_016 e2e_017 e2e_018 e2e_019 e2e_020 e2e_021 e2e_022 e2e_023 e2e_024 e2e_025 e2e_026 e2e_027 e2e_028 e2e_029 e2e_030 e2e_031 e2e_032
7878

7979
PHPSCOPER=bin/php-scoper.phar
8080

@@ -377,6 +377,20 @@ e2e_031: $(PHPSCOPER)
377377

378378
diff fixtures/set031-extension-symbol/expected-main.php build/set031-extension-symbol/main.php
379379

380+
.PHONY: e2e_032
381+
e2e_032: ## Run end-to-end tests for the fixture set 032 — isolated finder
382+
e2e_032: $(PHPSCOPER)
383+
php bin/php-scoper add-prefix \
384+
--working-dir=fixtures/set032-isolated-finder \
385+
--output-dir=../../build/set032-isolated-finder \
386+
--force \
387+
--no-interaction \
388+
--stop-on-failure
389+
390+
tree build/set032-isolated-finder > build/set032-isolated-finder/actual-tree
391+
392+
diff fixtures/set032-isolated-finder/expected-tree build/set032-isolated-finder/actual-tree
393+
380394
.PHONY: tb
381395
BLACKFIRE=blackfire
382396
tb: ## Run Blackfire profiling

fixtures/set006/scoper.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
return [
66
'patchers' => [
7-
function () {
7+
static function () {
88
return 'Hello world!';
99
}
1010
],

fixtures/set018-nikic-parser/scoper.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
return [
1818
'patchers' => [
19-
function (string $filePath, string $prefix, string $contents): string {
19+
static function (string $filePath, string $prefix, string $contents): string {
2020
//
2121
// PHP-Parser patch
2222
//
@@ -32,7 +32,7 @@ function (string $filePath, string $prefix, string $contents): string {
3232

3333
return $contents;
3434
},
35-
function (string $filePath, string $prefix, string $contents): string {
35+
static function (string $filePath, string $prefix, string $contents): string {
3636
$finderClass = sprintf('\%s\%s', $prefix, Finder::class);
3737

3838
return str_replace($finderClass, '\\'.Finder::class, $contents);

fixtures/set032-isolated-finder/dir/file1.php

Whitespace-only changes.

fixtures/set032-isolated-finder/dir/file2.php

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
build/set032-isolated-finder
2+
├── actual-tree
3+
├── file1.php
4+
└── file2.php
5+
6+
0 directories, 3 files
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
use Isolated\Symfony\Component\Finder\Finder;
4+
5+
return [
6+
'finders' => [
7+
(new Finder())
8+
->files()
9+
->in(__DIR__.DIRECTORY_SEPARATOR.'dir'),
10+
],
11+
];

0 commit comments

Comments
 (0)