Unverified Commit dec3b500 authored by Dave Reid's avatar Dave Reid Committed by Dave Reid

Issue #3100808 by Dave Reid, SpadXIII, marcoscano: Fixed errors when running...

Issue #3100808 by Dave Reid, SpadXIII, marcoscano: Fixed errors when running drush cron to regenerate the sitemaps. Removes unneeded PHPUnit assertion methods.
parent b228b106
......@@ -47,7 +47,7 @@ class DirectoryTest extends KernelTestBase {
// Test that nothing was deleted.
$this->assertFileExists('public://xmlsitemap/test/index.xml');
self::assertDirectoryExistsBridge('public://not-xmlsitemap');
$this->assertDirectoryExists('public://not-xmlsitemap');
$this->assertFileExists('public://file.txt');
$this->assertFalse($result);
......@@ -57,8 +57,8 @@ class DirectoryTest extends KernelTestBase {
$result = xmlsitemap_clear_directory(NULL, TRUE);
// Test that only the xmlsitemap directory was deleted.
self::assertDirectoryNotExists('public://xmlsitemap/test');
self::assertDirectoryExistsBridge('public://not-xmlsitemap');
$this->assertDirectoryNotExists('public://xmlsitemap/test');
$this->assertDirectoryExists('public://not-xmlsitemap');
$this->assertFileExists('public://file.txt');
$this->assertTrue($result);
}
......
......@@ -28,35 +28,7 @@ abstract class KernelTestBase extends CoreKernelTestBase {
// Install hooks are not run with kernel tests.
xmlsitemap_install();
self::assertDirectoryExistsBridge('public://xmlsitemap');
}
/**
* {@inheritdoc}
*
* This method is only available in PHPUnit 6+.
*/
public static function assertDirectoryExistsBridge($directory, $message = '') {
if (method_exists(get_parent_class(), 'assertDirectoryExists')) {
parent::assertDirectoryExists($directory, $message);
}
else {
parent::assertTrue(is_dir($directory), $message);
}
}
/**
* {@inheritdoc}
*
* This method is only available in PHPUnit 6+.
*/
public static function assertDirectoryNotExistsBridge($directory, $message = '') {
if (method_exists(get_parent_class(), 'assertDirectoryNotExists')) {
parent::assertDirectoryNotExists($directory, $message);
}
else {
parent::assertFalse(is_dir($directory), $message);
}
$this->assertDirectoryExists('public://xmlsitemap');
}
}
......@@ -5,5 +5,4 @@ package: 'XML Sitemap'
core_version_requirement: ^8.8 || ^9
configure: xmlsitemap.admin_search
test_dependencies:
- drupal:system (>= 8.8.0)
- robotstxt:robotstxt
......@@ -1471,7 +1471,12 @@ function xmlsitemap_run_unprogressive_batch() {
$batch['progressive'] = FALSE;
// Run the batch process.
if (PHP_SAPI === 'cli' && function_exists('drush_backend_batch_process')) {
drush_backend_batch_process();
}
else {
batch_process();
}
$lock->release($batch_callback);
return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment