mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 16:55:38 +08:00
Add new tests, remove redundant code
This commit is contained in:
24
tests/mock/SPC_store.php
Normal file
24
tests/mock/SPC_store.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// mock global functions
|
||||
|
||||
namespace SPC\store;
|
||||
|
||||
function f_exec(string $command, mixed &$output, mixed &$result_code): bool
|
||||
{
|
||||
if (str_contains($command, 'https://api.github.com/repos/AOMediaCodec/libavif/releases')) {
|
||||
$output = explode("\n", gzdecode(file_get_contents(__DIR__ . '/../assets/github_api_AOMediaCodec_libavif_releases.json.gz')));
|
||||
$result_code = 0;
|
||||
return true;
|
||||
}
|
||||
if (str_contains($command, 'https://api.github.com/repos/AOMediaCodec/libavif/tarball/v1.1.1')) {
|
||||
$output = explode("\n", "HTTP/1.1 200 OK\r\nContent-Disposition: attachment; filename=AOMediaCodec-libavif-v1.1.1-0-gbb24db0.tar.gz\r\n\r\n");
|
||||
$result_code = 0;
|
||||
return true;
|
||||
}
|
||||
$result_code = -2;
|
||||
$output = null;
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user