Skip to content

Commit

Permalink
improve testing cases
Browse files Browse the repository at this point in the history
  • Loading branch information
selul committed Nov 16, 2018
1 parent 2f4a2f9 commit b8633c2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/test-lazyload.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,24 @@ public function test_lazy_load() {
$this->assertContains( 'i.optimole.com', $replaced_content );
$this->assertContains( 'data-opt-src', $replaced_content );
$this->assertNotContains( 'http://example.org', $replaced_content );

$replaced_content = Optml_Replacer::instance()->replace_urls( Test_Replacer::IMG_TAGS_PNG );

$this->assertContains( 'i.optimole.com', $replaced_content );
$this->assertContains( 'data-opt-src', $replaced_content );
$this->assertEquals( 1, substr_count( $replaced_content, 'data-opt-src' ) );
}


public function test_lazy_load_off() {

define( 'OPTML_DISABLE_PNG_LAZYLOAD', true );

$replaced_content = Optml_Replacer::instance()->filter_the_content( Test_Replacer::IMG_TAGS_PNG );
$replaced_content = Optml_Replacer::instance()->filter_the_content( Test_Replacer::IMG_TAGS_PNG . Test_Replacer::IMG_TAGS );

$this->assertContains( 'i.optimole.com', $replaced_content );
$this->assertNotContains( 'data-opt-src', $replaced_content );
$this->assertContains( 'data-opt-src', $replaced_content );
$this->assertEquals( 1, substr_count( $replaced_content, 'data-opt-src' ) );

}
}

0 comments on commit b8633c2

Please sign in to comment.