Thunder2UpdateTest.php in Thunder 8.2
File
tests/src/Functional/Thunder2UpdateTest.php
View source
<?php
namespace Drupal\Tests\thunder\Functional;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\Tests\thunder\Traits\ThunderAwsTestFixtureTrait;
class Thunder2UpdateTest extends UpdatePathTestBase {
use ThunderAwsTestFixtureTrait;
protected function setUp() {
parent::setUp();
$module_handler = \Drupal::service('module_handler');
$this
->applyPatch('https://www.drupal.org/files/issues/2020-03-05/3117998.patch', $module_handler
->getModule('paragraphs')
->getPath());
}
protected $configSchemaCheckSkip = [
'core.entity_form_display.paragraph.image.default',
'core.entity_form_display.paragraph.video.default',
'core.entity_view_display.liveblog_post.liveblog_post.default',
'core.entity_view_display.paragraph.gallery.preview',
'nexx_integration.settings',
'views.view.fb_instant_articles',
];
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
$this
->getTestFixture("thunder.2-0.php.gz"),
];
}
public function testUpdate() {
$this
->runUpdates();
$this
->rebuildContainer();
$this
->assertTrue($this->container
->get('module_handler')
->moduleExists('config_selector'));
}
public function assertConfigSchema(TypedConfigManagerInterface $typed_config, $config_name, $config_data) {
if (in_array($config_name, $this->configSchemaCheckSkip, TRUE)) {
return;
}
return parent::assertConfigSchema($typed_config, $config_name, $config_data);
}
public function applyPatch($patch, $location) {
$old_cwd = getcwd();
chdir($location);
exec('/usr/bin/curl -s ' . escapeshellarg($patch) . ' | patch -p1', $output, $retcode);
chdir($old_cwd);
if ($retcode != 0) {
throw new \Exception("Patch {$patch} failed to apply.");
}
}
}