File tree Expand file tree Collapse file tree 2 files changed +55
-9
lines changed Expand file tree Collapse file tree 2 files changed +55
-9
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2017 Adobe
4
+ * All Rights Reserved .
5
5
*/
6
6
7
7
declare (strict_types=1 );
8
8
9
9
namespace Magento \Cms \Model \Wysiwyg ;
10
10
11
+ use Magento \Framework \DataObject ;
12
+ use Magento \Framework \View \Asset \Repository ;
13
+
11
14
/**
12
15
* Class DefaultConfigProvider returns data required to render tinymce editor
13
16
*/
14
17
class DefaultConfigProvider implements \Magento \Framework \Data \Wysiwyg \ConfigProviderInterface
15
18
{
16
19
/**
17
- * @var \Magento\Framework\View\Asset\ Repository
20
+ * @var Repository
18
21
*/
19
- private $ assetRepo ;
22
+ private Repository $ assetRepo ;
20
23
21
24
/**
22
- * @param \Magento\Framework\View\Asset\ Repository $assetRepo
25
+ * @param Repository $assetRepo
23
26
*/
24
- public function __construct (\ Magento \ Framework \ View \ Asset \ Repository $ assetRepo )
27
+ public function __construct (Repository $ assetRepo )
25
28
{
26
29
$ this ->assetRepo = $ assetRepo ;
27
30
}
28
31
29
32
/**
30
33
* @inheritdoc
31
34
*/
32
- public function getConfig (\ Magento \ Framework \ DataObject $ config ) : \ Magento \ Framework \ DataObject
35
+ public function getConfig (DataObject $ config ) : DataObject
33
36
{
34
37
$ config ->addData ([
35
38
'tinymce ' => [
36
- 'toolbar ' => ' blocks | formatselect | bold italic underline | alignleft aligncenter alignright | '
37
- . ' bullist numlist | link table charmap ' ,
39
+ 'toolbar ' => ' blocks fontfamily fontsize | formatselect | bold italic underline ' .
40
+ ' | alignleft aligncenter alignright | bullist numlist | link table charmap ' ,
38
41
'plugins ' => implode (
39
42
' ' ,
40
43
[
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright 2024 Adobe
4
+ * All Rights Reserved.
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magento \Cms \Test \Unit \Model \Wysiwyg ;
10
+
11
+ use Magento \Cms \Model \Wysiwyg \DefaultConfigProvider ;
12
+ use Magento \Framework \DataObject ;
13
+ use Magento \Framework \View \Asset \Repository ;
14
+ use PHPUnit \Framework \MockObject \MockObject ;
15
+ use PHPUnit \Framework \TestCase ;
16
+
17
+ class DefaultConfigProviderTest extends TestCase
18
+ {
19
+ /**
20
+ * @var Repository|MockObject
21
+ */
22
+ private Repository $ assetRepo ;
23
+
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ protected function setUp (): void
28
+ {
29
+ $ this ->assetRepo = $ this ->createMock (Repository::class);
30
+ parent ::setUp ();
31
+ }
32
+
33
+ /**
34
+ * @return void
35
+ */
36
+ public function testGetConfig (): void
37
+ {
38
+ $ config = new DataObject ();
39
+ $ configProvider = new DefaultConfigProvider ($ this ->assetRepo );
40
+ $ result = $ configProvider ->getConfig ($ config );
41
+ $ this ->assertStringContainsString ('fontfamily fontsize ' , $ result ->getTinymce ()['toolbar ' ]);
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments