Skip to content

Commit

Permalink
Add e2e test to ensure the isolated finder exists (#364)
Browse files Browse the repository at this point in the history
Closes #349
  • Loading branch information
theofidry authored Dec 13, 2019
1 parent bf7271c commit 829152c
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ env:
global:
secure: "1sVenz4DUy14AWE08s8V7Vz1D313t08R7axjBWI5R53BGNScm0lHlF/mONYEkdais5Mo9jkXwfzXIhqwqT6i9xltuIAIb1wUIwnQJCiACUGFWE4IP48ayD4KcjlExxoYHf2l98N0x/fc6ihwTa9pEHSH0cltr9wFJVbQD+lMC82V5gSVVzuteXjd7Dp/UFEgx3PcjRyvsrhySOE+qNInvOu3+ChPbFGE5Z18fncULJrEfVKpvOPBSYDDyI3A7KoHx/MrY9h3ow89S0jQw1AP1B5SVWKhIrFQT/d2oGeVPE382PSdnD5YiUNgcW85EHyFjt70oQyu1gxyIhRKygR+o02pDeanOJXp9wVsTo2yp6Nf/WWjniQenxxueM5MHfimMt1Khpx4ebiIuCOzIn6lhgQ1Aw6z3vVZelqk07zrIEycKJNWsto6a0X7H8McnJDyOlJ/PnbwXwsmcg29jDmNnKc6rGiQ08gK8BaZZfqhdtH8WxKxyUCuowprHslq614/W/4sLNophAOFSyOEFQl1Zqz3Ibe5EVPHbw5paxt9eY8W3gGajY8Bh1BYZOkXmkIgm4UFJHqslal/91Z4CIbLtCjGac0LWrvZaE5QFM8VRLmjgBWij5ajzFP5PI7S9JKJCETj8yrSRE51nAOPq1s1HmxdNQHmBa/xXQP8UahaRsM="

addons:
apt:
packages:
- tree

matrix:
include:
- php: '7.3'
Expand Down
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ tm: clover.xml

.PHONY: e2e
e2e: ## Run end-to-end tests
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: 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

PHPSCOPER=bin/php-scoper.phar

Expand Down Expand Up @@ -377,6 +377,20 @@ e2e_031: $(PHPSCOPER)

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

.PHONY: e2e_032
e2e_032: ## Run end-to-end tests for the fixture set 032 — isolated finder
e2e_032: $(PHPSCOPER)
php bin/php-scoper add-prefix \
--working-dir=fixtures/set032-isolated-finder \
--output-dir=../../build/set032-isolated-finder \
--force \
--no-interaction \
--stop-on-failure

tree build/set032-isolated-finder > build/set032-isolated-finder/actual-tree

diff fixtures/set032-isolated-finder/expected-tree build/set032-isolated-finder/actual-tree

.PHONY: tb
BLACKFIRE=blackfire
tb: ## Run Blackfire profiling
Expand Down
2 changes: 1 addition & 1 deletion fixtures/set006/scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

return [
'patchers' => [
function () {
static function () {
return 'Hello world!';
}
],
Expand Down
4 changes: 2 additions & 2 deletions fixtures/set018-nikic-parser/scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

return [
'patchers' => [
function (string $filePath, string $prefix, string $contents): string {
static function (string $filePath, string $prefix, string $contents): string {
//
// PHP-Parser patch
//
Expand All @@ -32,7 +32,7 @@ function (string $filePath, string $prefix, string $contents): string {

return $contents;
},
function (string $filePath, string $prefix, string $contents): string {
static function (string $filePath, string $prefix, string $contents): string {
$finderClass = sprintf('\%s\%s', $prefix, Finder::class);

return str_replace($finderClass, '\\'.Finder::class, $contents);
Expand Down
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions fixtures/set032-isolated-finder/expected-tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build/set032-isolated-finder
├── actual-tree
├── file1.php
└── file2.php

0 directories, 3 files
11 changes: 11 additions & 0 deletions fixtures/set032-isolated-finder/scoper.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

use Isolated\Symfony\Component\Finder\Finder;

return [
'finders' => [
(new Finder())
->files()
->in(__DIR__.DIRECTORY_SEPARATOR.'dir'),
],
];

0 comments on commit 829152c

Please sign in to comment.