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 11<?php
22/**
3- * Copyright © Magento, Inc. All rights reserved.
4- * See COPYING.txt for license details .
3+ * Copyright 2017 Adobe
4+ * All Rights Reserved .
55 */
66
77declare (strict_types=1 );
88
99namespace Magento \Cms \Model \Wysiwyg ;
1010
11+ use Magento \Framework \DataObject ;
12+ use Magento \Framework \View \Asset \Repository ;
13+
1114/**
1215 * Class DefaultConfigProvider returns data required to render tinymce editor
1316 */
1417class DefaultConfigProvider implements \Magento \Framework \Data \Wysiwyg \ConfigProviderInterface
1518{
1619 /**
17- * @var \Magento\Framework\View\Asset\ Repository
20+ * @var Repository
1821 */
19- private $ assetRepo ;
22+ private Repository $ assetRepo ;
2023
2124 /**
22- * @param \Magento\Framework\View\Asset\ Repository $assetRepo
25+ * @param Repository $assetRepo
2326 */
24- public function __construct (\ Magento \ Framework \ View \ Asset \ Repository $ assetRepo )
27+ public function __construct (Repository $ assetRepo )
2528 {
2629 $ this ->assetRepo = $ assetRepo ;
2730 }
2831
2932 /**
3033 * @inheritdoc
3134 */
32- public function getConfig (\ Magento \ Framework \ DataObject $ config ) : \ Magento \ Framework \ DataObject
35+ public function getConfig (DataObject $ config ) : DataObject
3336 {
3437 $ config ->addData ([
3538 '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 ' ,
3841 'plugins ' => implode (
3942 ' ' ,
4043 [
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