'; $expected_single_product_template = '
'; $result = BlockTemplatesCompatibility::wrap_single_product_template( $default_single_product_template ); $result_without_withespace = preg_replace( '/\s+/', '', $result ); $expected_single_product_template_without_whitespace = preg_replace( '/\s+/', '', $expected_single_product_template ); $this->assertEquals( $result_without_withespace, $expected_single_product_template_without_whitespace, '' ); } /** * Test that the Single Product Template is wrapped in a div with the correct class if it contains a block related to the Single Product Template. */ public function test_wrap_single_product_template_if_contains_single_product_blocks() { $default_single_product_template = '
'; $expected_single_product_template = '
'; $result = BlockTemplatesCompatibility::wrap_single_product_template( $default_single_product_template ); $result_without_withespace = preg_replace( '/\s+/', '', $result ); $expected_single_product_template_without_whitespace = preg_replace( '/\s+/', '', $expected_single_product_template ); $this->assertEquals( $result_without_withespace, $expected_single_product_template_without_whitespace, '' ); } /** * Test that the Single Product Template is wrapped in a div with the correct class if it contains a block related to the Single Product Template in a nested structure. */ public function test_wrap_single_product_template_if_contains_nested_single_product_blocks() { $default_single_product_template = '

'; $expected_single_product_template = '

'; $result = BlockTemplatesCompatibility::wrap_single_product_template( $default_single_product_template ); $result_without_withespace = preg_replace( '/\s+/', '', $result ); $expected_single_product_template_without_whitespace = preg_replace( '/\s+/', '', $expected_single_product_template ); $this->assertEquals( $result_without_withespace, $expected_single_product_template_without_whitespace, '' ); } /** * Test that the Single Product Template is wrapped in a div with the correct class if it contains a block related to the Single Product Template in a nested structure. */ public function test_wrap_single_product_template_without_a_main_wrapper() { $default_single_product_template = '

'; $expected_single_product_template = '

'; $result = BlockTemplatesCompatibility::wrap_single_product_template( $default_single_product_template ); $result_without_withespace = preg_replace( '/\s+/', '', $result ); $expected_single_product_template_without_whitespace = preg_replace( '/\s+/', '', $expected_single_product_template ); $this->assertEquals( $result_without_withespace, $expected_single_product_template_without_whitespace, '' ); } /** * Test that the Single Product Template is wrapped in a div with the correct class if it contains a block related to the Single Product Template. */ public function test_wrap_single_product_template_with_multiple_header() { $default_single_product_template = ' '; $expected_single_product_template = '
'; $result = BlockTemplatesCompatibility::wrap_single_product_template( $default_single_product_template ); $result_without_withespace = preg_replace( '/\s+/', '', $result ); $expected_single_product_template_without_whitespace = preg_replace( '/\s+/', '', $expected_single_product_template ); $this->assertEquals( $result_without_withespace, $expected_single_product_template_without_whitespace, '' ); } /** * Test that the Single Product Template is wrapped in a div with the correct class if it contains a block related to the Single Product Template. */ public function test_wrap_single_product_template_with_multiple_footer() { $default_single_product_template = ' '; $expected_single_product_template = '
'; $result = BlockTemplatesCompatibility::wrap_single_product_template( $default_single_product_template ); $result_without_withespace = preg_replace( '/\s+/', '', $result ); $expected_single_product_template_without_whitespace = preg_replace( '/\s+/', '', $expected_single_product_template ); $this->assertEquals( $result_without_withespace, $expected_single_product_template_without_whitespace, '' ); } /** * Test that the Single Product Template is wrapped in a div with the correct class if it contains a block related to the Single Product Template. */ public function test_wrap_single_product_template_with_multiple_blocks_related_to_the_single_product_template() { $default_single_product_template = '

test

'; $expected_single_product_template = '

test

'; $result = BlockTemplatesCompatibility::wrap_single_product_template( $default_single_product_template ); $result_without_withespace = preg_replace( '/\s+/', '', $result ); $expected_single_product_template_without_whitespace = preg_replace( '/\s+/', '', $expected_single_product_template ); $this->assertEquals( $result_without_withespace, $expected_single_product_template_without_whitespace, '' ); } }