Skip to content

Commit

Permalink
Add test -- #7029
Browse files Browse the repository at this point in the history
  • Loading branch information
Khadreal committed Jan 23, 2025
1 parent fca3411 commit fef9b20
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,20 @@
'html' => file_get_contents( WP_ROCKET_TESTS_FIXTURES_DIR . '/inc/Engine/Optimization/LazyRenderContent/Frontend/Subscriber/html/expected_exclusions.php' ),
]
],
'shouldNotAddHashesWhenDonotoptimize' => [
'config' => [
'donotrocketoptimize' => true,
'row' => [
'url' => 'http://example.org/',
'is_mobile' => 0,
'below_the_fold' => json_encode([]),
'status' => 'completed'
],
'html' => file_get_contents( WP_ROCKET_TESTS_FIXTURES_DIR . '/inc/Engine/Optimization/LazyRenderContent/Frontend/Subscriber/html/original.php' ),
],
'expected' => [
'html' => file_get_contents( WP_ROCKET_TESTS_FIXTURES_DIR . '/inc/Engine/Optimization/LazyRenderContent/Frontend/Subscriber/html/original.php' ),
]
],
]
];
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @group PerformanceHints
*/
class Test_AddHashes extends TestCase {
class Test_Add_Hashes extends TestCase {
private $max_hashes;

public static function set_up_before_class() {
Expand Down Expand Up @@ -46,6 +46,7 @@ public function tear_down() {
*/
public function testShouldWorkAsExpected( $config, $expected ) {
self::addLrc( $config['row'] );
$this->donotrocketoptimize = $config['donotrocketoptimize'] ?? null;

add_filter( 'rocket_lrc_optimization', '__return_true' );
add_filter( 'rocket_lrc_exclusions', function() use ($config) {
Expand Down

0 comments on commit fef9b20

Please sign in to comment.