-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: background image replacement url
- Loading branch information
1 parent
aaf2815
commit d176c11
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* WordPress unit test plugin. | ||
* | ||
* @package Optimole-WP | ||
* @subpackage Tests | ||
* @copyright Copyright (c) 2017, ThemeIsle | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | ||
*/ | ||
class Test_Background_Image extends WP_UnitTestCase | ||
{ | ||
|
||
const IMG_TAGS_GIF = '<div data-hash="5c2602bbe76e6f966a846fb661b9d76d" data-desktop="//366b4e08.ngrok.io/wp-content/uploads/2019/08/image3-10-5.jpg" class="n2-ss-slide-background-image" data-blur="0" style="background-image:url("//example.org/wp-content/themes/test/assets/images/header-300x300.png");"> </div>'; | ||
|
||
|
||
public static $sample_post; | ||
|
||
public function setUp() | ||
{ | ||
|
||
parent::setUp(); | ||
$settings = new Optml_Settings(); | ||
$settings->update('service_data', [ | ||
'cdn_key' => 'test123', | ||
'cdn_secret' => '12345', | ||
'whitelist' => ['example.com'], | ||
|
||
]); | ||
$settings->update('lazyload', 'disabled'); | ||
$settings->update('img_to_video', 'enabled'); | ||
|
||
|
||
Optml_Url_Replacer::instance()->init(); | ||
Optml_Tag_Replacer::instance()->init(); | ||
Optml_Manager::instance()->init(); | ||
|
||
self::$sample_post = self::factory()->post->create([ | ||
'post_title' => 'Test post', | ||
'post_content' => self::IMG_TAGS_GIF | ||
] | ||
); | ||
} | ||
|
||
public function test_should_replace_tag() | ||
{ | ||
|
||
$replaced_content = Optml_Manager::instance()->replace_content(self::IMG_TAGS_GIF); | ||
$this->assertContains('i.optimole.com', $replaced_content); | ||
} | ||
} | ||
|
d176c11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@preda-bogdan this is the fix for schema-less