forked from civictheme/monorepo-drupal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCivicthemeUpdatePathBareTest.php
More file actions
114 lines (97 loc) · 4.9 KB
/
Copy pathCivicthemeUpdatePathBareTest.php
File metadata and controls
114 lines (97 loc) · 4.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
namespace Drupal\Tests\civictheme\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Tests the hook_post_update_NAME() implementations on bare database.
*
* @group civictheme:functional:update
* @group site:functional
*/
class CivicthemeUpdatePathBareTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected static $configSchemaCheckerExclusions = [
// Exclude "broken" schemas provided in the database dumps. When a new
// version is released - the dump is updated and schemas are fixed - review
// this list and remove items.
'civictheme.settings',
'core.entity_form_display.node.civictheme_event.default',
'core.entity_form_display.node.civictheme_page.default',
'block.block.civictheme_footer_acknowledgment_of_country',
'block.block.civictheme_footer_copyright',
'block.block.civictheme_footer_social_links',
'simple_sitemap.custom_links.default',
'simple_sitemap.custom_links.index',
];
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->container->get('module_installer')->install(['sqlite']);
}
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../fixtures/updates/drupal_10.0.0-rc1.minimal.civictheme_1.3.2.bare.php.gz',
];
}
/**
* Tests that the database was properly loaded.
*
* This is a smoke test for the hook_update_N() CivicTheme test system itself.
*/
public function testDatabaseLoaded() {
$this->assertEquals('minimal', \Drupal::config('core.extension')->get('profile'));
// Ensure that a user can be created and do a basic test that
// the site is available by logging in.
$this->drupalLogin($this->createUser(admin: TRUE));
$this->assertSession()->statusCodeEquals(200);
}
/**
* Tests updates.
*/
public function testUpdates() {
$this->runUpdates();
$this->assertSession()->pageTextContains('Update rename_block_banner_blend_mode');
$this->assertSession()->pageTextContains("Content from field 'field_c_b_blend_mode' was moved to 'field_c_b_banner_blend_mode'.");
$this->assertSession()->pageTextContains('Update ran in');
$this->assertSession()->pageTextContains('Processed: 0');
$this->assertSession()->pageTextContains('Updated: 0');
$this->assertSession()->pageTextContains('Update rename_event_date_field');
$this->assertSession()->pageTextContains("Content from field 'field_c_n_date' was moved to 'field_c_n_date_range'. The 'field_c_n_date_range' field was removed from 'civictheme_event' node type.");
$this->assertSession()->pageTextContains('Update ran in');
$this->assertSession()->pageTextContains('Processed: 0');
$this->assertSession()->pageTextContains('Updated: 0');
$this->assertSession()->pageTextContains('Update rename_list_fields');
$this->assertSession()->pageTextContains("Content from field 'field_c_p_column_count' was moved to 'field_c_p_list_column_count'. Content from field 'field_c_p_fill_width' was moved to 'field_c_p_list_fill_width'.");
$this->assertSession()->pageTextContains('Update ran in');
$this->assertSession()->pageTextContains('Processed: 0');
$this->assertSession()->pageTextContains('Updated: 0');
$this->assertSession()->pageTextContains('Update rename_node_banner_blend_mode');
$this->assertSession()->pageTextContains("Content from field 'field_c_n_blend_mode' was moved to 'field_c_n_banner_blend_mode'.");
$this->assertSession()->pageTextContains("The 'field_c_n_blend_mode' field was removed from 'civictheme_page' node type.");
$this->assertSession()->pageTextContains('Update ran in');
$this->assertSession()->pageTextContains('Processed: 0');
$this->assertSession()->pageTextContains('Updated: 0');
$this->assertSession()->pageTextContains('Update replace_summary_field');
$this->assertSession()->pageTextContains("Content from field 'field_c_p_summary' was moved to 'field_c_p_content'. The 'field_c_p_summary' field was removed from civictheme_attachment, civictheme_callout, civictheme_next_step, civictheme_promo paragraph types.");
$this->assertSession()->pageTextContains('Update ran in');
$this->assertSession()->pageTextContains('Processed: 0');
$this->assertSession()->pageTextContains('Processed: 0');
$this->assertSession()->pageTextContains('Updated: 0');
$this->assertSession()->pageTextContains('Update set_vertical_spacing_empty_value');
$this->assertSession()->pageTextContains("Updated values for fields 'field_c_n_vertical_spacing' and 'field_c_p_vertical_spacing'.");
$this->assertSession()->pageTextContains('Update ran in');
$this->assertSession()->pageTextContains('Processed: 0');
$this->assertSession()->pageTextContains('Processed: 0');
$this->assertSession()->pageTextContains('Updated: 0');
}
}