| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/maitricfuz/www/maitric/libraries/vendor/php-tuf/php-tuf/tests/Client/ |
Upload File : |
<?php
namespace Tuf\Tests\Client;
use Tuf\Exception\RepoFileNotFound;
use Tuf\Tests\ClientTestBase;
/**
* Tests refreshing the updater when the server is in an invalid state.
*/
class InvalidRefreshTest extends ClientTestBase
{
/**
* @testWith ["consistent"]
* ["inconsistent"]
*/
public function testRefreshFromServerInInvalidState(string $fixtureVariant): void
{
$fixtureName = 'Simple/' . $fixtureVariant;
$this->loadClientAndServerFilesFromFixture($fixtureName);
$updater = $this->getUpdater();
// This refresh should succeed.
$updater->refresh();
// Put the server-side repo into an invalid state.
unset($this->serverFiles['timestamp.json']);
// The updater is already refreshed, so this will return early, and
// there should be no changes to the client-side repo.
$updater->refresh();
$this->assertMetadataVersions(static::getClientStartVersions($fixtureName), $this->clientStorage);
// If we force a refresh, the invalid state of the server-side repo will
// raise an exception.
$this->expectException(RepoFileNotFound::class);
$this->expectExceptionMessage('File timestamp.json not found.');
$updater->refresh(true);
}
}