Skip to content

Commit

Permalink
Remove padraic/humbug_get_contents (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
villfa authored Sep 22, 2020
1 parent 60cb5e7 commit ffe0f80
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 23 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
"bamarni/composer-bin-plugin": "^1.3",
"infection/infection": "^0.15",
"mikey179/vfsstream": "^1.6",
"padraic/humbug_get_contents": "^1.1",
"phpunit/phpunit": "^8.1",
"symfony/phpunit-bridge": "^4.2 || ^5.0"
},
Expand Down
1 change: 0 additions & 1 deletion requirement-checker/tests/CheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use Generator;
use PHPUnit\Framework\TestCase;
use function ob_get_contents;
use function preg_replace;
use const PHP_VERSION;

Expand Down
22 changes: 11 additions & 11 deletions tests/Composer/ComposerOrchestratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

namespace KevinGH\Box\Composer;

use function file_get_contents;
use Generator;
use function Humbug\get_contents;
use Humbug\PhpScoper\Whitelist;
use function iterator_to_array;
use KevinGH\Box\Console\DisplayNormalizer;
Expand Down Expand Up @@ -66,7 +66,7 @@ public function test_it_can_dump_the_autoloader_with_an_empty_composer_json(
$actualAutoloadContents = preg_replace(
'/ComposerAutoloaderInit[a-z\d]{32}/',
'ComposerAutoloaderInit80c62b20a4a44fb21e8e102ccb92ff05',
get_contents($this->tmp.'/vendor/autoload.php')
file_get_contents($this->tmp.'/vendor/autoload.php')
);
$actualAutoloadContents = DisplayNormalizer::removeTrailingSpaces($actualAutoloadContents);

Expand All @@ -89,7 +89,7 @@ public function test_it_can_dump_the_autoloader_with_an_empty_composer_json(
preg_replace(
'/ComposerAutoloaderInit[a-z\d]{32}/',
'ComposerAutoloaderInit80c62b20a4a44fb21e8e102ccb92ff05',
get_contents($this->tmp.'/vendor/composer/autoload_psr4.php')
file_get_contents($this->tmp.'/vendor/composer/autoload_psr4.php')
)
);
}
Expand Down Expand Up @@ -161,7 +161,7 @@ public function test_it_can_dump_the_autoloader_with_a_composer_json_with_a_depe
preg_replace(
'/ComposerAutoloaderInit[a-z\d]{32}/',
'ComposerAutoloaderInit80c62b20a4a44fb21e8e102ccb92ff05',
get_contents($this->tmp.'/vendor/autoload.php')
file_get_contents($this->tmp.'/vendor/autoload.php')
)
);

Expand All @@ -182,7 +182,7 @@ public function test_it_can_dump_the_autoloader_with_a_composer_json_with_a_depe
preg_replace(
'/ComposerAutoloaderInit[a-z\d]{32}/',
'ComposerAutoloaderInit80c62b20a4a44fb21e8e102ccb92ff05',
get_contents($this->tmp.'/vendor/composer/autoload_psr4.php')
file_get_contents($this->tmp.'/vendor/composer/autoload_psr4.php')
)
);
}
Expand Down Expand Up @@ -268,7 +268,7 @@ public function test_it_can_dump_the_autoloader_with_a_composer_json_lock_and_in
preg_replace(
'/ComposerAutoloaderInit[a-z\d]{32}/',
'ComposerAutoloaderInit80c62b20a4a44fb21e8e102ccb92ff05',
get_contents($this->tmp.'/vendor/autoload.php')
file_get_contents($this->tmp.'/vendor/autoload.php')
)
);

Expand All @@ -290,7 +290,7 @@ public function test_it_can_dump_the_autoloader_with_a_composer_json_lock_and_in
preg_replace(
'/ComposerAutoloaderInit[a-z\d]{32}/',
'ComposerAutoloaderInit80c62b20a4a44fb21e8e102ccb92ff05',
get_contents($this->tmp.'/vendor/composer/autoload_psr4.php')
file_get_contents($this->tmp.'/vendor/composer/autoload_psr4.php')
)
);
}
Expand Down Expand Up @@ -360,7 +360,7 @@ public function test_it_can_dump_the_autoloader_with_a_composer_json_lock_and_in
preg_replace(
'/ComposerAutoloaderInit[a-z\d]{32}/',
'ComposerAutoloaderInit80c62b20a4a44fb21e8e102ccb92ff05',
get_contents($this->tmp.'/vendor/autoload.php')
file_get_contents($this->tmp.'/vendor/autoload.php')
)
);

Expand All @@ -381,7 +381,7 @@ public function test_it_can_dump_the_autoloader_with_a_composer_json_lock_and_in
preg_replace(
'/ComposerAutoloaderInit[a-z\d]{32}/',
'ComposerAutoloaderInit80c62b20a4a44fb21e8e102ccb92ff05',
get_contents($this->tmp.'/vendor/composer/autoload_psr4.php')
file_get_contents($this->tmp.'/vendor/composer/autoload_psr4.php')
)
);
}
Expand Down Expand Up @@ -431,7 +431,7 @@ public function test_it_can_dump_the_autoloader_with_a_composer_json_and_lock_wi
preg_replace(
'/ComposerAutoloaderInit[a-z\d]{32}/',
'ComposerAutoloaderInit80c62b20a4a44fb21e8e102ccb92ff05',
get_contents($this->tmp.'/vendor/autoload.php')
file_get_contents($this->tmp.'/vendor/autoload.php')
)
);

Expand All @@ -452,7 +452,7 @@ public function test_it_can_dump_the_autoloader_with_a_composer_json_and_lock_wi
preg_replace(
'/ComposerAutoloaderInit[a-z\d]{32}/',
'ComposerAutoloaderInit80c62b20a4a44fb21e8e102ccb92ff05',
get_contents($this->tmp.'/vendor/composer/autoload_psr4.php')
file_get_contents($this->tmp.'/vendor/composer/autoload_psr4.php')
)
);
}
Expand Down
16 changes: 8 additions & 8 deletions tests/Configuration/ConfigurationFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

use function chdir;
use const DIRECTORY_SEPARATOR;
use function file_get_contents;
use Generator;
use function Humbug\get_contents;
use function Humbug\PhpScoper\json_decode;
use InvalidArgumentException;
use function KevinGH\Box\FileSystem\dump_file;
Expand Down Expand Up @@ -1745,7 +1745,7 @@ public function test_no_warning_is_given_when_no_installed_json_no_composer_lock
{
$config = Configuration::create(
$configPath = self::FIXTURES_DIR.'/dir000/box.json',
json_decode(get_contents($configPath), false)
json_decode(file_get_contents($configPath), false)
);

$this->assertSame([], $config->getRecommendations());
Expand All @@ -1756,7 +1756,7 @@ public function test_no_warning_is_given_when_the_installed_json_and_composer_lo
{
$config = Configuration::create(
$configPath = self::FIXTURES_DIR.'/dir001/box.json',
json_decode(get_contents($configPath), false)
json_decode(file_get_contents($configPath), false)
);

$this->assertTrue($config->dumpAutoload());
Expand All @@ -1767,7 +1767,7 @@ public function test_no_warning_is_given_when_the_installed_json_and_composer_lo

public function test_no_warning_is_given_when_the_installed_json_is_found_and_the_composer_lock_is_not_when_the_composer_autoloader_is_not_dumped(): void
{
$config = Configuration::create($configPath = self::FIXTURES_DIR.'/dir002/box.json', json_decode(get_contents($configPath)));
$config = Configuration::create($configPath = self::FIXTURES_DIR.'/dir002/box.json', json_decode(file_get_contents($configPath)));

$this->assertFalse($config->dumpAutoload());

Expand All @@ -1777,7 +1777,7 @@ public function test_no_warning_is_given_when_the_installed_json_is_found_and_th

public function test_a_warning_is_given_when_no_installed_json_is_found_and_the_composer_lock_is_when_the_composer_autoloader_is_dumped(): void
{
$decodedConfig = json_decode(get_contents($configPath = self::FIXTURES_DIR.'/dir002/box.json'));
$decodedConfig = json_decode(file_get_contents($configPath = self::FIXTURES_DIR.'/dir002/box.json'));
$decodedConfig->{'dump-autoload'} = true;

$config = Configuration::create($configPath, $decodedConfig);
Expand All @@ -1798,7 +1798,7 @@ public function test_no_warning_is_given_when_the_installed_json_is_found_and_th
{
$configPath = self::FIXTURES_DIR.'/dir003/box.json';

$decodedConfig = json_decode(get_contents($configPath));
$decodedConfig = json_decode(file_get_contents($configPath));
unset($decodedConfig->{'dump-autoload'});

$config = Configuration::create($configPath, $decodedConfig);
Expand All @@ -1811,7 +1811,7 @@ public function test_no_warning_is_given_when_the_installed_json_is_found_and_th

public function test_a_warning_is_given_when_the_installed_json_is_found_and_the_composer_lock_is_not(): void
{
$config = Configuration::create($configPath = self::FIXTURES_DIR.'/dir003/box.json', json_decode(get_contents($configPath)));
$config = Configuration::create($configPath = self::FIXTURES_DIR.'/dir003/box.json', json_decode(file_get_contents($configPath)));

$this->assertFalse($config->dumpAutoload());

Expand All @@ -1827,7 +1827,7 @@ public function test_a_warning_is_given_when_the_installed_json_is_found_and_the

public function test_no_warning_is_given_when_the_installed_json_is_found_and_the_composer_lock_is_not_and_the_dump_autoload_disabled(): void
{
$config = Configuration::create($configPath = self::FIXTURES_DIR.'/dir004/box.json', json_decode(get_contents($configPath)));
$config = Configuration::create($configPath = self::FIXTURES_DIR.'/dir004/box.json', json_decode(file_get_contents($configPath)));

$this->assertFalse($config->dumpAutoload());

Expand Down
3 changes: 1 addition & 2 deletions tests/Console/Command/CompileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use function file_get_contents;
use Generator;
use function get_loaded_extensions;
use function Humbug\get_contents;
use function implode;
use InvalidArgumentException;
use function iterator_to_array;
Expand Down Expand Up @@ -1338,7 +1337,7 @@ public function test_it_can_build_a_PHAR_file_in_debug_mode(): void

// Checks one of the dumped file from the PHAR to ensure the encoding of the extracted file is correct
$this->assertSame(
get_contents('.box_dump/index.php'),
file_get_contents('.box_dump/index.php'),
$indexContents
);
}
Expand Down

0 comments on commit ffe0f80

Please sign in to comment.