-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0747f76
commit 9b4976d
Showing
17 changed files
with
503 additions
and
727 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
tests/Fixtures/inc/ThirdParty/Plugins/PageBuilder/Elementor/addFixAnimationsScript.php
This file was deleted.
Oops, something went wrong.
46 changes: 28 additions & 18 deletions
46
tests/Fixtures/inc/ThirdParty/Plugins/PageBuilder/Elementor/maybeClearCacheChangeNotice.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,32 @@ | ||
<?php | ||
|
||
$input = file_get_contents(__DIR__ . '/HTML/input.html'); | ||
$output = file_get_contents(__DIR__ . '/HTML/output.html'); | ||
$output_added = file_get_contents(__DIR__ . '/HTML/output_added.html'); | ||
return [ | ||
'' => [ | ||
'config' => [ | ||
'boxes' => [], | ||
'user_id' => 10, | ||
'can' => true, | ||
'transient' => true, | ||
'notice' => true, | ||
], | ||
'expected' => [ | ||
'notice' => [ | ||
'status' => 'warning', | ||
'dismissible' => '', | ||
'dismiss_button' => 'maybe_clear_cache_change_notice', | ||
'message' => '<strong>WP Rocket:</strong> Your Elementor template was updated. Clear the Used CSS if the layout, design or CSS styles were changed.', | ||
'action' => 'clear_cache', | ||
] | ||
] | ||
], | ||
'AddScript' => [ | ||
'config' => [ | ||
'html' => $input, | ||
'script' => 'script', | ||
'is_allowed' => true, | ||
], | ||
'expected' => $output_added | ||
], | ||
'NotAllowedShouldReturnSame' => [ | ||
'config' => [ | ||
'html' => $input, | ||
'script' => 'script', | ||
'is_allowed' => false, | ||
], | ||
'expected' => $output | ||
], | ||
'NoScriptShould' => [ | ||
'config' => [ | ||
'html' => $input, | ||
'script' => false, | ||
'is_allowed' => true, | ||
], | ||
'expected' => $output | ||
], | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
tests/Unit/inc/ThirdParty/Plugins/PageBuilder/Elementor/ElementorTestTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace ThirdParty\Plugins\PageBuilder\Elementor; | ||
use Mockery; | ||
use WP_Filesystem_Direct; | ||
use WP_Rocket\Admin\Options_Data; | ||
use WP_Rocket\Engine\Common\Ajax\AjaxHandler; | ||
use WP_Rocket\Engine\Optimization\DelayJS\HTML; | ||
use WP_Rocket\Engine\Optimization\RUCSS\Controller\UsedCSS; | ||
use WP_Rocket\ThirdParty\Plugins\PageBuilder\Elementor; | ||
|
||
trait ElementorTestTrait | ||
{ | ||
/** | ||
* @var Options_Data | ||
*/ | ||
protected $options; | ||
|
||
protected $filesystem; | ||
|
||
/** | ||
* @var HTML | ||
*/ | ||
protected $delayjs_html; | ||
|
||
/** | ||
* @var UsedCSS | ||
*/ | ||
protected $used_css; | ||
|
||
/** | ||
* @var AjaxHandler | ||
*/ | ||
protected $ajax_handler; | ||
|
||
/** | ||
* @var Elementor | ||
*/ | ||
protected $elementor; | ||
|
||
public function set_up() { | ||
parent::set_up(); | ||
$this->options = Mockery::mock(Options_Data::class); | ||
$this->filesystem = Mockery::mock(WP_Filesystem_Direct::class); | ||
$this->delayjs_html = Mockery::mock(HTML::class); | ||
$this->used_css = Mockery::mock(UsedCSS::class); | ||
$this->ajax_handler = Mockery::mock(AjaxHandler::class); | ||
|
||
$this->elementor = new Elementor($this->options, $this->filesystem, $this->delayjs_html, $this->used_css, $this->ajax_handler); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
tests/Unit/inc/ThirdParty/Plugins/PageBuilder/Elementor/addFixAnimationsScript.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.