__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Tuf\Tests\Client;
use GuzzleHttp\Promise\Create;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Psr7\Utils;
use Tuf\Exception\RepoFileNotFound;
use Tuf\Loader\LoaderInterface;
/**
* Loads files from a simulated, in-memory server.
*/
class TestLoader extends \ArrayObject implements LoaderInterface
{
/**
* The $maxBytes arguments passed to ::load(), keyed by file name.
*
* This is used to confirm that the updater passes the expected file names
* and maximum download lengths.
*
* @var int[][]
*/
public array $maxBytes = [];
/**
* Populates this object with a fixture's server-side metadata.
*
* @param string $basePath
* The path of the fixture to read from.
*/
public function populateFromFixture(string $basePath): void
{
$this->exchangeArray([]);
// Store the file contents in memory so they can be easily altered.
$fixturesPath = "$basePath/server";
$files = glob("$fixturesPath/metadata/*.json");
$targetsPath = "$fixturesPath/targets";
if (is_dir($targetsPath)) {
$files = array_merge($files, glob("$targetsPath/*"));
}
foreach ($files as $file) {
$baseName = basename($file);
if ($this->offsetExists($baseName)) {
throw new \UnexpectedValueException("For testing fixtures target files should not use metadata file names");
}
$this[$baseName] = file_get_contents($file);
}
}
/**
* {@inheritDoc}
*/
public function load(string $locator, int $maxBytes): PromiseInterface
{
$this->maxBytes[$locator][] = $maxBytes;
if ($this->offsetExists($locator)) {
$stream = Utils::streamFor($this[$locator]);
return Create::promiseFor($stream);
} else {
return Create::rejectionFor(new RepoFileNotFound("File $locator not found."));
}
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| ConsistentFixturesUpdaterTest.php | File | 5.79 KB | 0664 |
|
| HashedBinsTest.php | File | 822 B | 0664 |
|
| InconsistentFixturesUpdaterTest.php | File | 4.3 KB | 0664 |
|
| InvalidRefreshTest.php | File | 1.27 KB | 0664 |
|
| RoleDownloadLimitTest.php | File | 1.46 KB | 0664 |
|
| RollbackAttackTest.php | File | 1.82 KB | 0664 |
|
| SnapshotHashesTest.php | File | 1.3 KB | 0664 |
|
| TestLoader.php | File | 1.95 KB | 0664 |
|
| UnchangedTimestampTest.php | File | 972 B | 0664 |
|
| UpdaterTest.php | File | 40.51 KB | 0664 |
|
| VerifiedDownloadTest.php | File | 2.23 KB | 0664 |
|