init(); } /** * Test get and set items. */ public function test_style_inline() { $email = new WC_Email(); // Test HTML email with inline styles. $email->email_type = 'html'; // Set some content to get converted. $result = $email->style_inline( '

Hello World!

' ); ob_start(); include WC_Unit_Tests_Bootstrap::instance()->tests_dir . '/data/sample-email.html'; $expected = ob_get_clean(); $this->assertEquals( $expected, $result ); // Test plain text email. $email->email_type = 'plain'; // Set some content to get converted. $result = $email->style_inline( '

Hello World!

' ); $expected = '

Hello World!

'; $this->assertEquals( $expected, $result ); } /** * Test that we remove elemets with style display none from html mails. */ public function test_remove_display_none_elements() { $email = new WC_Email(); $email->email_type = 'html'; $str_present = 'Should be present!'; $str_removed = 'Should be removed!'; $result = $email->style_inline( "
$str_present
$str_removed
" ); $this->assertTrue( false !== strpos( $result, $str_present ) ); $this->assertTrue( false === strpos( $result, $str_removed ) ); } }