1.20.x update.test | UpdateCoreTestCase::testGetUpdaterFromDirectory() |
Test that getUpdaterFromDirectory() gets the right class for core updates.
File
- modules/
update/ tests/ update.test, line 282 - This file contains tests for the Update Manager module.
Class
Code
function testGetUpdaterFromDirectory() {
module_load_include('inc', 'installer', 'installer.manager');
// Extract our stub sample backdop zip archive to temporary.
$extract_directory = _installer_manager_extract_directory();
$file = backdrop_get_path('module', 'update') . '/tests/backdrop-sample.zip';
$archive = installer_manager_archive_extract($file, $extract_directory);
$realpath = backdrop_realpath($extract_directory . '/backdrop');
// Create an Updater and check for the responsible class.
// If the check for core failed, either a wrong class is returned,
// or an UpdaterException is thrown.
$updater = Updater::factory($realpath);
$updater_class = $updater->getUpdaterFromDirectory($realpath);
$success = $this->assertEqual($updater_class, 'CoreUpdater', 'Determine "CoreUpdater" as updater class for core.');
if (!$success) {
$this->verbose("Failed to determine correct class, <em>$updater_class</em> was picked instead.");
}
}