1
1
<?php
2
2
3
- namespace Drupal \Tests \ghi_content \Kernel ;
3
+ namespace Drupal \Tests \ghi_blocks \Kernel ;
4
4
5
- use Drupal \KernelTests \KernelTestBase ;
6
5
use Drupal \Tests \user \Traits \UserCreationTrait ;
7
6
use Drupal \file \Entity \File ;
8
7
use Drupal \ghi_image \CropManager ;
9
8
use Drupal \layout_builder \Plugin \SectionStorage \OverridesSectionStorage ;
10
9
use Drupal \layout_builder \Section ;
11
- use Drupal \layout_builder \SectionComponent ;
12
10
use Drupal \node \Entity \Node ;
13
11
use Drupal \node \Entity \NodeType ;
14
12
15
13
/**
16
- * Tests aspects of the block logic .
14
+ * Tests blocks that can have with managed files uploaded .
17
15
*
18
16
* @group ghi_blocks
19
17
*/
20
- class BlocksWithManagedFilesTest extends KernelTestBase {
18
+ class BlocksWithManagedFilesTest extends BlockKernelTestBase {
21
19
22
20
use UserCreationTrait;
23
21
@@ -32,22 +30,13 @@ class BlocksWithManagedFilesTest extends KernelTestBase {
32
30
'node ' ,
33
31
'taxonomy ' ,
34
32
'field ' ,
35
- 'layout_builder ' ,
36
- 'layout_discovery ' ,
37
- 'layout_builder ' ,
38
33
'text ' ,
39
34
'filter ' ,
40
35
'file ' ,
41
36
'token ' ,
42
37
'path ' ,
43
38
'path_alias ' ,
44
39
'pathauto ' ,
45
- 'hpc_api ' ,
46
- // 'hpc_common',
47
- 'ghi_form_elements ' ,
48
- 'ghi_subpages ' ,
49
- 'ghi_sections ' ,
50
- 'ghi_blocks ' ,
51
40
];
52
41
53
42
const BUNDLE = 'page ' ;
@@ -198,42 +187,36 @@ public function testFilesAreNotDeletedByRevisionUpdates() {
198
187
*/
199
188
private function addLinkBlockWithFileToNode ($ node , $ file ) {
200
189
$ configuration = [
201
- 'id ' => 'links ' ,
202
- 'label ' => '<none> ' ,
203
- 'label_display ' => FALSE ,
204
- 'provider ' => 'ghi_blocks ' ,
205
- 'hpc ' => [
190
+ 'links ' => [
206
191
'links ' => [
207
- ' links ' => [
208
- [
209
- ' id ' => 1 ,
210
- ' item_type ' => ' link ' ,
211
- 'config ' => [
212
- ' label ' => ' Test link with image ' ,
192
+ [
193
+ ' id ' => 1 ,
194
+ ' item_type ' => ' link ' ,
195
+ ' config ' => [
196
+ 'label ' => ' Test link with image ' ,
197
+ ' link ' => [
213
198
'link ' => [
214
- 'link ' => [
215
- 'label ' => NULL ,
216
- 'link_type ' => 'custom ' ,
217
- 'link_custom ' => [
218
- 'url ' => 'https://google.com ' ,
219
- ],
220
- 'link_related ' => [
221
- 'target ' => NULL ,
222
- ],
199
+ 'label ' => NULL ,
200
+ 'link_type ' => 'custom ' ,
201
+ 'link_custom ' => [
202
+ 'url ' => 'https://google.com ' ,
223
203
],
224
- ],
225
- 'image ' => [
226
- 'image ' => [$ file ->id ()],
227
- ],
228
- 'content ' => [
229
- 'date ' => '2024-05-22 ' ,
230
- 'description ' => [
231
- 'value ' => '' ,
232
- 'format ' => 'wysiwyg_simple ' ,
204
+ 'link_related ' => [
205
+ 'target ' => NULL ,
233
206
],
234
- 'description_toggle ' => 0 ,
235
207
],
236
208
],
209
+ 'image ' => [
210
+ 'image ' => [$ file ->id ()],
211
+ ],
212
+ 'content ' => [
213
+ 'date ' => '2024-05-22 ' ,
214
+ 'description ' => [
215
+ 'value ' => '' ,
216
+ 'format ' => 'wysiwyg_simple ' ,
217
+ ],
218
+ 'description_toggle ' => 0 ,
219
+ ],
237
220
],
238
221
],
239
222
],
@@ -245,7 +228,7 @@ private function addLinkBlockWithFileToNode($node, $file) {
245
228
0 => ['section ' => new Section ('layout_onecol ' , [], [])],
246
229
];
247
230
// Add a new component to the section with delta 0.
248
- $ component = new SectionComponent ( ' 10000000-0000-1000-a000-000000000000 ' , ' content ' , $ configuration );
231
+ $ component = $ this -> createSectionComponent ( ' links ' , $ configuration );
249
232
$ sections [0 ]['section ' ]->appendComponent ($ component );
250
233
251
234
// Store the modified sections in the node.
0 commit comments