-
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 #21 from wunderio/feature/disable_reporting
Add setting to "disable" reporting
- Loading branch information
Showing
14 changed files
with
93 additions
and
14 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
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
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
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
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
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,73 @@ | ||
<?php | ||
|
||
namespace Drupal\Tests\updates_log\Kernel; | ||
|
||
use Drupal\Core\Site\Settings; | ||
use Drupal\Core\Database\Connection; | ||
use Drupal\KernelTests\KernelTestBase; | ||
use Drupal\updates_log\UpdatesLog; | ||
|
||
/** | ||
* Tests that "updates_log_disabled" setting works as expected. | ||
* | ||
* @group updates_log | ||
*/ | ||
class UpdatesLogDisabledTest extends KernelTestBase { | ||
|
||
/** | ||
* The UpdatesLog service. | ||
* | ||
* @var \Drupal\updates_log\UpdatesLog | ||
*/ | ||
private UpdatesLog $updatesLogService; | ||
|
||
/** | ||
* The Database Connection. | ||
* | ||
* @var \Drupal\Core\Database\Connection | ||
*/ | ||
private Connection $db; | ||
|
||
/** | ||
* The modules to load to run the test. | ||
* | ||
* @var array | ||
*/ | ||
protected static $modules = [ | ||
'update', | ||
'updates_log', | ||
'dblog', | ||
]; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function setUp(): void { | ||
parent::setUp(); | ||
$this->installConfig(['updates_log']); | ||
$this->installSchema('dblog', ['watchdog']); | ||
$this->updatesLogService = \Drupal::service('updates_log.updates_logger'); | ||
$this->db = \Drupal::database(); | ||
} | ||
|
||
/** | ||
* Test that there is no output when disabled = TRUE. | ||
*/ | ||
public function testDisabledDoesNotRun(): void { | ||
new Settings(['updates_log_disabled' => TRUE]); | ||
$this->updatesLogService->run(); | ||
$query = $this->db->query("select * from {watchdog}"); | ||
$result = $query->fetchAll(); | ||
$this->assertEmpty($result); | ||
} | ||
|
||
/** | ||
* If UpdatesLogRunTest::testCrash is good then we know this works. | ||
* | ||
* @depends Drupal\Tests\updates_log\Kernel\UpdatesLogRunTest::testCrash | ||
*/ | ||
public function testNotDisabledRuns(): void { | ||
$this->assertTrue(TRUE); | ||
} | ||
|
||
} |
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
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