X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fredirect%2Fmodules%2Fredirect_404%2Ftests%2Fsrc%2FUnit%2FSqlRedirectNotFoundStorageTest.php;h=42e0224e565a5a87e82918ac958ecf79d8fb7175;hp=b9ba88f3d28120ea3628f5655cc9d776406f331e;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/modules/contrib/redirect/modules/redirect_404/tests/src/Unit/SqlRedirectNotFoundStorageTest.php b/web/modules/contrib/redirect/modules/redirect_404/tests/src/Unit/SqlRedirectNotFoundStorageTest.php index b9ba88f3d..42e0224e5 100644 --- a/web/modules/contrib/redirect/modules/redirect_404/tests/src/Unit/SqlRedirectNotFoundStorageTest.php +++ b/web/modules/contrib/redirect/modules/redirect_404/tests/src/Unit/SqlRedirectNotFoundStorageTest.php @@ -21,6 +21,13 @@ class SqlRedirectNotFoundStorageTest extends UnitTestCase { */ protected $database; + /** + * Mock config factory. + * + * @var \Drupal\Core\Config\ConfigFactoryInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $configFactory; + /** * {@inheritdoc} */ @@ -51,4 +58,21 @@ class SqlRedirectNotFoundStorageTest extends UnitTestCase { $storage->logRequest("Caf\xc3", LanguageInterface::LANGCODE_DEFAULT); } + /** + * Tests that all logs are kept if row limit config is "All". + */ + public function testPurgeOldRequests() { + $this->configFactory = $this->getConfigFactoryStub( + [ + 'redirect_404.settings' => [ + 'row_limit' => 0, + ], + ] + ); + $storage = new SqlRedirectNotFoundStorage($this->database, $this->configFactory); + $storage->purgeOldRequests(); + $this->database->expects($this->never()) + ->method('select'); + } + }