-
Notifications
You must be signed in to change notification settings - Fork 216
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
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...tion/inc/Engine/Optimization/LazyRenderContent/Frontend/Filter/lrcProcessedTagsFilter.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,36 @@ | ||
<?php | ||
namespace WP_Rocket\Tests\Integration\inc\Engine\Optimization\LazyRenderContent\Frontend\Filter; | ||
|
||
use WP_Rocket\Engine\Optimization\LazyRenderContent\Frontend\Processor\Dom; | ||
use WP_Rocket\Engine\Optimization\LazyRenderContent\Frontend\Processor\HelperTrait; | ||
use WP_Rocket\Tests\Integration\TestCase; | ||
use ReflectionClass; | ||
|
||
/** | ||
* Test class covering \WP_Rocket\Engine\Optimization\LazyRenderContent\Frontend\ProcessorHelperTrait::get_processed_tags() | ||
* | ||
* @group PerformanceHints | ||
*/ | ||
class Test_lrcProcessedTagsFilter extends TestCase | ||
{ | ||
public function testShouldReturnAsExpected() { | ||
add_filter( 'rocket_lazy_render_content_processed_tags', function( $tags ) { | ||
$tags[]= 'h2'; | ||
$tags[]= 'h1'; | ||
$tags[]= 'li'; | ||
|
||
return $tags; | ||
}); | ||
|
||
$dom = new Dom(); | ||
$instance = new ReflectionClass( $dom ); | ||
$method = $instance->getMethod( 'get_processed_tags' ); | ||
|
||
$method->setAccessible(true); | ||
$result = $method->invoke( $dom ); | ||
|
||
$expected = [ 'DIV', 'MAIN', 'FOOTER', 'SECTION', 'ARTICLE', 'HEADER', 'H2', 'H1', 'LI' ]; | ||
|
||
$this->assertSame( $expected, $result ); | ||
} | ||
} |