-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from wunderio/bugfix/refresh
Refactor refresh()
- Loading branch information
Showing
4 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace Drupal\Tests\updates_log\Kernel; | ||
|
||
use Drupal\KernelTests\KernelTestBase; | ||
use Drupal\updates_log\UpdatesLog; | ||
|
||
/** | ||
* Test refresh handling. | ||
* | ||
* @group updates_log | ||
*/ | ||
class RefreshTest extends KernelTestBase { | ||
|
||
/** | ||
* The UpdatesLog service. | ||
* | ||
* @var \Drupal\updates_log\UpdatesLog | ||
*/ | ||
private UpdatesLog $updatesLogService; | ||
|
||
/** | ||
* The modules to load to run the test. | ||
* | ||
* @var array | ||
*/ | ||
protected static $modules = [ | ||
'update', | ||
'updates_log', | ||
]; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function setUp(): void { | ||
parent::setUp(); | ||
$this->installConfig(['updates_log']); | ||
$this->installConfig(['update']); | ||
$this->updatesLogService = \Drupal::service('updates_log.updates_logger'); | ||
} | ||
|
||
/** | ||
* @covers ::refresh | ||
*/ | ||
public function testRefreshOld(): void { | ||
|
||
\Drupal::state()->set('update.last_check', 0); | ||
|
||
$this->updatesLogService->refresh(); | ||
$statuses = $this->updatesLogService->statusesGet(); | ||
|
||
$this->assertGreaterThan(0, count($statuses)); | ||
} | ||
|
||
/** | ||
* @covers ::refresh | ||
*/ | ||
public function testRefreshNew(): void { | ||
|
||
\Drupal::state()->set('update.last_check', time()); | ||
|
||
$this->updatesLogService->refresh(); | ||
$statuses = $this->updatesLogService->statusesGet(); | ||
|
||
$this->assertGreaterThan(0, count($statuses)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters