From 0299fe94cf188dbd6d9b41a117775da681f94077 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 26 Jan 2023 14:24:53 +0100 Subject: [PATCH 01/10] SSR: Query all wp- attributes, then call matching processors --- wp-directives.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-directives.php b/wp-directives.php index d4d034fe..cff8e0e0 100644 --- a/wp-directives.php +++ b/wp-directives.php @@ -223,13 +223,14 @@ function wp_process_directives( $block_content ) { call_user_func( $directives[ $tag_name ], $tags, $context ); } else { // Components can't have directives (unless we change our mind about this). - foreach ( $directives as $directive => $directive_processor ) { - $attributes = $tags->get_attribute_names_with_prefix( $directive ); - if ( empty( $attributes ) ) { + $attributes = $tags->get_attribute_names_with_prefix( 'wp-' ); + + foreach ( $attributes as $attribute ) { + if ( ! array_key_exists( $attribute, $directives ) ) { continue; } - call_user_func( $directive_processor, $tags, $context ); + call_user_func( $directives[ $attribute ], $tags, $context ); } } } From 33972e18c0b9b9f85d0d53825501009eb111a0e6 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 26 Jan 2023 14:28:07 +0100 Subject: [PATCH 02/10] Handle attribute directives separately from tag directives --- wp-directives.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/wp-directives.php b/wp-directives.php index cff8e0e0..344eda41 100644 --- a/wp-directives.php +++ b/wp-directives.php @@ -207,11 +207,15 @@ function bhe_inner_blocks( $parsed_block, $source_block, $parent_block ) { function wp_process_directives( $block_content ) { // TODO: Add some directive/components registration mechanism. - $directives = array( + $tag_directives = array( 'wp-context' => 'process_wp_context', - 'wp-bind' => 'process_wp_bind', - 'wp-class' => 'process_wp_class', - 'wp-style' => 'process_wp_style', + ); + + $attribute_directives = array( + // 'wp-context' => 'process_wp_context', // TODO + 'wp-bind' => 'process_wp_bind', + 'wp-class' => 'process_wp_class', + 'wp-style' => 'process_wp_style', ); $tags = new WP_HTML_Tag_Processor( $block_content ); @@ -219,18 +223,18 @@ function wp_process_directives( $block_content ) { $context = new WP_Directive_Context; while ( $tags->next_tag( array( 'tag_closers' => 'visit' ) ) ) { $tag_name = strtolower( $tags->get_tag() ); - if ( array_key_exists( $tag_name, $directives ) ) { - call_user_func( $directives[ $tag_name ], $tags, $context ); + if ( array_key_exists( $tag_name, $tag_directives ) ) { + call_user_func( $tag_directives[ $tag_name ], $tags, $context ); } else { // Components can't have directives (unless we change our mind about this). $attributes = $tags->get_attribute_names_with_prefix( 'wp-' ); foreach ( $attributes as $attribute ) { - if ( ! array_key_exists( $attribute, $directives ) ) { + if ( ! array_key_exists( $attribute, $attribute_directives ) ) { continue; } - call_user_func( $directives[ $attribute ], $tags, $context ); + call_user_func( $attribute_directives[ $attribute ], $tags, $context ); } } } From a895681fedcb257f61228adf4b2524546ebd4d63 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 26 Jan 2023 14:30:45 +0100 Subject: [PATCH 03/10] Remove now-obsolete logic and tests for some attribute directives --- phpunit/directives/wp-bind.php | 14 -------------- phpunit/directives/wp-class.php | 14 -------------- phpunit/directives/wp-style.php | 14 -------------- src/directives/wp-bind.php | 8 -------- src/directives/wp-class.php | 8 -------- src/directives/wp-style.php | 8 -------- 6 files changed, 66 deletions(-) diff --git a/phpunit/directives/wp-bind.php b/phpunit/directives/wp-bind.php index 1e6c4122..84e8d599 100644 --- a/phpunit/directives/wp-bind.php +++ b/phpunit/directives/wp-bind.php @@ -46,18 +46,4 @@ public function test_directive_ignores_empty_bound_attribute() { $this->assertNull( $tags->get_attribute( 'src' ) ); $this->assertSame( $context_before->get_context(), $context->get_context(), 'wp-bind directive changed context' ); } - - public function test_directive_ignores_wp_bind_tag() { - $markup = ''; - $tags = new WP_HTML_Tag_Processor( $markup ); - $tags->next_tag(); - - $context_before = new WP_Directive_Context( array( 'myblock' => array( 'imageSource' => './wordpress.png' ) ) ); - $context = $context_before; - process_wp_bind( $tags, $context ); - - $this->assertSame( $markup, $tags->get_updated_html() ); - $this->assertNull( $tags->get_attribute( 'src' ) ); - $this->assertSame( $context_before->get_context(), $context->get_context(), 'wp-bind directive changed context' ); - } } diff --git a/phpunit/directives/wp-class.php b/phpunit/directives/wp-class.php index 22494e24..d677411f 100644 --- a/phpunit/directives/wp-class.php +++ b/phpunit/directives/wp-class.php @@ -98,18 +98,4 @@ public function test_directive_ignores_empty_class_name() { $this->assertStringNotContainsString( 'red', $tags->get_attribute( 'class' ) ); $this->assertSame( $context_before->get_context(), $context->get_context(), 'wp-class directive changed context' ); } - - public function test_directive_ignores_wp_class_tag() { - $markup = 'Test'; - $tags = new WP_HTML_Tag_Processor( $markup ); - $tags->next_tag(); - - $context_before = new WP_Directive_Context( array( 'myblock' => array( 'isRed' => true ) ) ); - $context = $context_before; - process_wp_class( $tags, $context ); - - $this->assertSame( $markup, $tags->get_updated_html() ); - $this->assertStringNotContainsString( 'red', $tags->get_attribute( 'class' ) ); - $this->assertSame( $context_before->get_context(), $context->get_context(), 'wp-class directive changed context' ); - } } diff --git a/phpunit/directives/wp-style.php b/phpunit/directives/wp-style.php index 37749bd6..e86f978f 100644 --- a/phpunit/directives/wp-style.php +++ b/phpunit/directives/wp-style.php @@ -46,18 +46,4 @@ public function test_directive_ignores_empty_style() { $this->assertStringNotContainsString( 'color: green;', $tags->get_attribute( 'style' ) ); $this->assertSame( $context_before->get_context(), $context->get_context(), 'wp-style directive changed context' ); } - - public function test_directive_ignores_wp_style_tag() { - $markup = 'Test'; - $tags = new WP_HTML_Tag_Processor( $markup ); - $tags->next_tag(); - - $context_before = new WP_Directive_Context( array( 'myblock' => array( 'color' => 'green' ) ) ); - $context = $context_before; - process_wp_style( $tags, $context ); - - $this->assertSame( $markup, $tags->get_updated_html() ); - $this->assertStringNotContainsString( 'color: green;', $tags->get_attribute( 'style' ) ); - $this->assertSame( $context_before->get_context(), $context->get_context(), 'wp-style directive changed context' ); - } } diff --git a/src/directives/wp-bind.php b/src/directives/wp-bind.php index 4fce3690..d3256dbf 100644 --- a/src/directives/wp-bind.php +++ b/src/directives/wp-bind.php @@ -7,14 +7,6 @@ function process_wp_bind( $tags, $context ) { return; } - /** - * A `wp-bind` *tag* doesn't really make sense. - * What would be the point of e.g. `? - */ - if ( 'WP-BIND' === $tags->get_tag() ) { - return; - } - $prefixed_attributes = $tags->get_attribute_names_with_prefix( 'wp-bind:' ); foreach ( $prefixed_attributes as $attr ) { diff --git a/src/directives/wp-class.php b/src/directives/wp-class.php index b6af6505..84142b3d 100644 --- a/src/directives/wp-class.php +++ b/src/directives/wp-class.php @@ -7,14 +7,6 @@ function process_wp_class( $tags, $context ) { return; } - /** - * A `wp-class` *tag* doesn't really make sense. - * What would be the point of e.g. `? - */ - if ( 'WP-CLASS' === $tags->get_tag() ) { - return; - } - $prefixed_attributes = $tags->get_attribute_names_with_prefix( 'wp-class:' ); foreach ( $prefixed_attributes as $attr ) { diff --git a/src/directives/wp-style.php b/src/directives/wp-style.php index 6441d0a6..95500606 100644 --- a/src/directives/wp-style.php +++ b/src/directives/wp-style.php @@ -7,14 +7,6 @@ function process_wp_style( $tags, $context ) { return; } - /** - * A `wp-style` *tag* doesn't really make sense. - * What would be the point of e.g. `? - */ - if ( 'WP-STYLE' === $tags->get_tag() ) { - return; - } - $prefixed_attributes = $tags->get_attribute_names_with_prefix( 'wp-style:' ); foreach ( $prefixed_attributes as $attr ) { From a771378d84364f8dba7fa956d25a49288b1669a8 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 26 Jan 2023 14:34:52 +0100 Subject: [PATCH 04/10] Remove now-obsolete logic from wp-context tag processor --- src/directives/wp-context.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/directives/wp-context.php b/src/directives/wp-context.php index cd6e4ca0..0fdb1f33 100644 --- a/src/directives/wp-context.php +++ b/src/directives/wp-context.php @@ -1,17 +1,12 @@ get_tag() ) { - if ( $tags->is_tag_closer() ) { - $context->rewind_context(); - return; - } - $value = $tags->get_attribute( 'data' ); - } else { - // TODO: Implement rewinding context upon matching closing tag. - $value = $tags->get_attribute( 'wp-context' ); + if ( $tags->is_tag_closer() ) { + $context->rewind_context(); + return; } + $value = $tags->get_attribute( 'data' ); if ( null === $value ) { // No wp-context directive. return; From 7477d7634174145bbb6e85b8e80b15c854fab3a1 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 26 Jan 2023 14:44:36 +0100 Subject: [PATCH 05/10] Mark wp-context attribute test as skipped --- phpunit/directives/wp-context.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpunit/directives/wp-context.php b/phpunit/directives/wp-context.php index 84e6dd62..f938b8f0 100644 --- a/phpunit/directives/wp-context.php +++ b/phpunit/directives/wp-context.php @@ -61,6 +61,8 @@ public function test_directive_resets_context_correctly_upon_closing_wp_context_ } public function test_directive_merges_context_correctly_upon_wp_context_attribute_on_opening_tag() { + $this->markTestSkipped( 'Need to implement the wp-context attribute directive processor first.' ); + $context = new WP_Directive_Context( array( 'myblock' => array( 'open' => false ), From df0928b2f6cbf98fd488ebb5fabf46874d61e83d Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 26 Jan 2023 14:51:49 +0100 Subject: [PATCH 06/10] Organize files into tags and attributes subfolders --- .../directives/{ => attributes}/wp-bind.php | 6 +-- .../directives/{ => attributes}/wp-class.php | 6 +-- phpunit/directives/attributes/wp-context.php | 43 +++++++++++++++++++ .../directives/{ => attributes}/wp-style.php | 6 +-- phpunit/directives/{ => tags}/wp-context.php | 8 ++-- src/directives/{ => attributes}/wp-bind.php | 2 +- src/directives/{ => attributes}/wp-class.php | 2 +- src/directives/{ => attributes}/wp-style.php | 2 +- src/directives/{ => tags}/wp-context.php | 0 wp-directives.php | 9 ++-- 10 files changed, 64 insertions(+), 20 deletions(-) rename phpunit/directives/{ => attributes}/wp-bind.php (86%) rename phpunit/directives/{ => attributes}/wp-class.php (94%) create mode 100644 phpunit/directives/attributes/wp-context.php rename phpunit/directives/{ => attributes}/wp-style.php (87%) rename phpunit/directives/{ => tags}/wp-context.php (87%) rename src/directives/{ => attributes}/wp-bind.php (92%) rename src/directives/{ => attributes}/wp-class.php (93%) rename src/directives/{ => attributes}/wp-style.php (95%) rename src/directives/{ => tags}/wp-context.php (100%) diff --git a/phpunit/directives/wp-bind.php b/phpunit/directives/attributes/wp-bind.php similarity index 86% rename from phpunit/directives/wp-bind.php rename to phpunit/directives/attributes/wp-bind.php index 84e8d599..53c5beb2 100644 --- a/phpunit/directives/wp-bind.php +++ b/phpunit/directives/attributes/wp-bind.php @@ -3,11 +3,11 @@ * wp-bind directive test. */ -require_once __DIR__ . '/../../src/directives/wp-bind.php'; +require_once __DIR__ . '/../../../src/directives/wp-bind.php'; -require_once __DIR__ . '/../../src/directives/class-wp-directive-context.php'; +require_once __DIR__ . '/../../../src/directives/class-wp-directive-context.php'; -require_once __DIR__ . '/../../../gutenberg/lib/experimental/html/index.php'; +require_once __DIR__ . '/../../../../gutenberg/lib/experimental/html/index.php'; /** * Tests for the wp-bind directive. diff --git a/phpunit/directives/wp-class.php b/phpunit/directives/attributes/wp-class.php similarity index 94% rename from phpunit/directives/wp-class.php rename to phpunit/directives/attributes/wp-class.php index d677411f..9dbdc33b 100644 --- a/phpunit/directives/wp-class.php +++ b/phpunit/directives/attributes/wp-class.php @@ -3,11 +3,11 @@ * wp-class directive test. */ -require_once __DIR__ . '/../../src/directives/wp-class.php'; +require_once __DIR__ . '/../../../src/directives/wp-class.php'; -require_once __DIR__ . '/../../src/directives/class-wp-directive-context.php'; +require_once __DIR__ . '/../../../src/directives/class-wp-directive-context.php'; -require_once __DIR__ . '/../../../gutenberg/lib/experimental/html/index.php'; +require_once __DIR__ . '/../../../../gutenberg/lib/experimental/html/index.php'; /** * Tests for the wp-class directive. diff --git a/phpunit/directives/attributes/wp-context.php b/phpunit/directives/attributes/wp-context.php new file mode 100644 index 00000000..f074bf15 --- /dev/null +++ b/phpunit/directives/attributes/wp-context.php @@ -0,0 +1,43 @@ +markTestSkipped( 'Need to implement the wp-context attribute directive processor first.' ); + + $context = new WP_Directive_Context( + array( + 'myblock' => array( 'open' => false ), + 'otherblock' => array( 'somekey' => 'somevalue' ), + ) + ); + + $markup = '
'; + $tags = new WP_HTML_Tag_Processor( $markup ); + $tags->next_tag(); + + process_wp_context( $tags, $context ); + + $this->assertSame( + array( + 'myblock' => array( 'open' => true ), + 'otherblock' => array( 'somekey' => 'somevalue' ), + ), + $context->get_context() + ); + } +} diff --git a/phpunit/directives/wp-style.php b/phpunit/directives/attributes/wp-style.php similarity index 87% rename from phpunit/directives/wp-style.php rename to phpunit/directives/attributes/wp-style.php index e86f978f..1e3cff1f 100644 --- a/phpunit/directives/wp-style.php +++ b/phpunit/directives/attributes/wp-style.php @@ -3,11 +3,11 @@ * wp-style directive test. */ -require_once __DIR__ . '/../../src/directives/wp-style.php'; +require_once __DIR__ . '/../../../src/directives/wp-style.php'; -require_once __DIR__ . '/../../src/directives/class-wp-directive-context.php'; +require_once __DIR__ . '/../../../src/directives/class-wp-directive-context.php'; -require_once __DIR__ . '/../../../gutenberg/lib/experimental/html/index.php'; +require_once __DIR__ . '/../../../../gutenberg/lib/experimental/html/index.php'; /** * Tests for the wp-style directive. diff --git a/phpunit/directives/wp-context.php b/phpunit/directives/tags/wp-context.php similarity index 87% rename from phpunit/directives/wp-context.php rename to phpunit/directives/tags/wp-context.php index f938b8f0..a9234de6 100644 --- a/phpunit/directives/wp-context.php +++ b/phpunit/directives/tags/wp-context.php @@ -3,11 +3,11 @@ * wp-context directive test. */ -require_once __DIR__ . '/../../src/directives/wp-context.php'; +require_once __DIR__ . '/../../../src/directives/wp-context.php'; -require_once __DIR__ . '/../../src/directives/class-wp-directive-context.php'; +require_once __DIR__ . '/../../../src/directives/class-wp-directive-context.php'; -require_once __DIR__ . '/../../../gutenberg/lib/experimental/html/index.php'; +require_once __DIR__ . '/../../../../gutenberg/lib/experimental/html/index.php'; /** * Tests for the wp-context directive. @@ -15,7 +15,7 @@ * @group directives * @covers process_wp_context */ -class Tests_Directives_WpContext extends WP_UnitTestCase { +class Tests_Directives_WpContext_Tag extends WP_UnitTestCase { public function test_directive_merges_context_correctly_upon_opening_wp_context_tag() { $context = new WP_Directive_Context( array( diff --git a/src/directives/wp-bind.php b/src/directives/attributes/wp-bind.php similarity index 92% rename from src/directives/wp-bind.php rename to src/directives/attributes/wp-bind.php index d3256dbf..88d8d8f3 100644 --- a/src/directives/wp-bind.php +++ b/src/directives/attributes/wp-bind.php @@ -1,6 +1,6 @@ is_tag_closer() ) { diff --git a/src/directives/wp-class.php b/src/directives/attributes/wp-class.php similarity index 93% rename from src/directives/wp-class.php rename to src/directives/attributes/wp-class.php index 84142b3d..1151c913 100644 --- a/src/directives/wp-class.php +++ b/src/directives/attributes/wp-class.php @@ -1,6 +1,6 @@ is_tag_closer() ) { diff --git a/src/directives/wp-style.php b/src/directives/attributes/wp-style.php similarity index 95% rename from src/directives/wp-style.php rename to src/directives/attributes/wp-style.php index 95500606..8019a9f6 100644 --- a/src/directives/wp-style.php +++ b/src/directives/attributes/wp-style.php @@ -1,6 +1,6 @@ is_tag_closer() ) { diff --git a/src/directives/wp-context.php b/src/directives/tags/wp-context.php similarity index 100% rename from src/directives/wp-context.php rename to src/directives/tags/wp-context.php diff --git a/wp-directives.php b/wp-directives.php index 344eda41..3f4b82be 100644 --- a/wp-directives.php +++ b/wp-directives.php @@ -37,12 +37,13 @@ function () { require_once __DIR__ . '/../gutenberg/lib/experimental/html/index.php'; -require_once __DIR__ . '/src/directives/wp-context.php'; -require_once __DIR__ . '/src/directives/wp-context.php'; -require_once __DIR__ . '/src/directives/wp-bind.php'; -require_once __DIR__ . '/src/directives/wp-class.php'; require_once __DIR__ . '/src/directives/class-wp-directive-context.php'; +require_once __DIR__ . '/src/directives/attributes/wp-bind.php'; +require_once __DIR__ . '/src/directives/attributes/wp-class.php'; +require_once __DIR__ . '/src/directives/attributes/wp-style.php'; +require_once __DIR__ . '/src/directives/tags/wp-context.php'; + function wp_directives_loader() { // Load the Admin page. require_once plugin_dir_path( __FILE__ ) . '/src/admin/admin-page.php'; From aafaa1592c2595d6cb2f6f931b6b030aea348e5a Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 26 Jan 2023 14:55:04 +0100 Subject: [PATCH 07/10] Differentiate wp_context tag and attribute processors --- phpunit/directives/attributes/wp-context.php | 10 +++++----- phpunit/directives/tags/wp-context.php | 14 +++++++------- src/directives/tags/wp-context.php | 2 +- wp-directives.php | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/phpunit/directives/attributes/wp-context.php b/phpunit/directives/attributes/wp-context.php index f074bf15..ba817e1e 100644 --- a/phpunit/directives/attributes/wp-context.php +++ b/phpunit/directives/attributes/wp-context.php @@ -1,6 +1,6 @@ markTestSkipped( 'Need to implement the wp-context attribute directive processor first.' ); @@ -30,7 +30,7 @@ public function test_directive_merges_context_correctly_upon_wp_context_attribut $tags = new WP_HTML_Tag_Processor( $markup ); $tags->next_tag(); - process_wp_context( $tags, $context ); + process_wp_context_attribute( $tags, $context ); $this->assertSame( array( diff --git a/phpunit/directives/tags/wp-context.php b/phpunit/directives/tags/wp-context.php index a9234de6..18427513 100644 --- a/phpunit/directives/tags/wp-context.php +++ b/phpunit/directives/tags/wp-context.php @@ -1,6 +1,6 @@ next_tag(); - process_wp_context( $tags, $context ); + process_wp_context_tag( $tags, $context ); $this->assertSame( array( @@ -52,7 +52,7 @@ public function test_directive_resets_context_correctly_upon_closing_wp_context_ $tags = new WP_HTML_Tag_Processor( $markup ); $tags->next_tag( array( 'tag_closers' => 'visit' ) ); - process_wp_context( $tags, $context ); + process_wp_context_tag( $tags, $context ); $this->assertSame( array( 'my-key' => 'original-value' ), @@ -74,7 +74,7 @@ public function test_directive_merges_context_correctly_upon_wp_context_attribut $tags = new WP_HTML_Tag_Processor( $markup ); $tags->next_tag(); - process_wp_context( $tags, $context ); + process_wp_context_tag( $tags, $context ); $this->assertSame( array( diff --git a/src/directives/tags/wp-context.php b/src/directives/tags/wp-context.php index 0fdb1f33..bf2b2a30 100644 --- a/src/directives/tags/wp-context.php +++ b/src/directives/tags/wp-context.php @@ -1,6 +1,6 @@ is_tag_closer() ) { $context->rewind_context(); return; diff --git a/wp-directives.php b/wp-directives.php index 3f4b82be..a72ce368 100644 --- a/wp-directives.php +++ b/wp-directives.php @@ -209,11 +209,11 @@ function bhe_inner_blocks( $parsed_block, $source_block, $parent_block ) { function wp_process_directives( $block_content ) { // TODO: Add some directive/components registration mechanism. $tag_directives = array( - 'wp-context' => 'process_wp_context', + 'wp-context' => 'process_wp_context_tag', ); $attribute_directives = array( - // 'wp-context' => 'process_wp_context', // TODO + // 'wp-context' => 'process_wp_context_attribute', // TODO 'wp-bind' => 'process_wp_bind', 'wp-class' => 'process_wp_class', 'wp-style' => 'process_wp_style', From b7728e1f9cccd9689265698509068d5265e25ba7 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 26 Jan 2023 14:57:51 +0100 Subject: [PATCH 08/10] Fix import paths --- phpunit/directives/attributes/wp-bind.php | 2 +- phpunit/directives/attributes/wp-class.php | 2 +- phpunit/directives/attributes/wp-context.php | 2 +- phpunit/directives/attributes/wp-style.php | 2 +- phpunit/directives/tags/wp-context.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpunit/directives/attributes/wp-bind.php b/phpunit/directives/attributes/wp-bind.php index 53c5beb2..4b74df24 100644 --- a/phpunit/directives/attributes/wp-bind.php +++ b/phpunit/directives/attributes/wp-bind.php @@ -3,7 +3,7 @@ * wp-bind directive test. */ -require_once __DIR__ . '/../../../src/directives/wp-bind.php'; +require_once __DIR__ . '/../../../src/directives/attributes/wp-bind.php'; require_once __DIR__ . '/../../../src/directives/class-wp-directive-context.php'; diff --git a/phpunit/directives/attributes/wp-class.php b/phpunit/directives/attributes/wp-class.php index 9dbdc33b..e8fef2b4 100644 --- a/phpunit/directives/attributes/wp-class.php +++ b/phpunit/directives/attributes/wp-class.php @@ -3,7 +3,7 @@ * wp-class directive test. */ -require_once __DIR__ . '/../../../src/directives/wp-class.php'; +require_once __DIR__ . '/../../../src/directives/attributes/wp-class.php'; require_once __DIR__ . '/../../../src/directives/class-wp-directive-context.php'; diff --git a/phpunit/directives/attributes/wp-context.php b/phpunit/directives/attributes/wp-context.php index ba817e1e..30529bef 100644 --- a/phpunit/directives/attributes/wp-context.php +++ b/phpunit/directives/attributes/wp-context.php @@ -3,7 +3,7 @@ * wp-context attribute directive test. */ -require_once __DIR__ . '/../../../src/directives/wp-context.php'; +require_once __DIR__ . '/../../../src/directives/attributes/wp-context.php'; require_once __DIR__ . '/../../../src/directives/class-wp-directive-context.php'; diff --git a/phpunit/directives/attributes/wp-style.php b/phpunit/directives/attributes/wp-style.php index 1e3cff1f..99be8e9a 100644 --- a/phpunit/directives/attributes/wp-style.php +++ b/phpunit/directives/attributes/wp-style.php @@ -3,7 +3,7 @@ * wp-style directive test. */ -require_once __DIR__ . '/../../../src/directives/wp-style.php'; +require_once __DIR__ . '/../../../src/directives/attributes/wp-style.php'; require_once __DIR__ . '/../../../src/directives/class-wp-directive-context.php'; diff --git a/phpunit/directives/tags/wp-context.php b/phpunit/directives/tags/wp-context.php index 18427513..c2623477 100644 --- a/phpunit/directives/tags/wp-context.php +++ b/phpunit/directives/tags/wp-context.php @@ -3,7 +3,7 @@ * wp-context tag directive test. */ -require_once __DIR__ . '/../../../src/directives/wp-context.php'; +require_once __DIR__ . '/../../../src/directives/tags/wp-context.php'; require_once __DIR__ . '/../../../src/directives/class-wp-directive-context.php'; From 34d9cb33536a1a866abf7429a61a9cd2f4b715af Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 26 Jan 2023 15:03:03 +0100 Subject: [PATCH 09/10] Fix more import paths --- src/directives/attributes/wp-bind.php | 2 +- src/directives/attributes/wp-class.php | 2 +- src/directives/attributes/wp-style.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/directives/attributes/wp-bind.php b/src/directives/attributes/wp-bind.php index 88d8d8f3..628e7110 100644 --- a/src/directives/attributes/wp-bind.php +++ b/src/directives/attributes/wp-bind.php @@ -1,6 +1,6 @@ is_tag_closer() ) { diff --git a/src/directives/attributes/wp-class.php b/src/directives/attributes/wp-class.php index 1151c913..0e27d3eb 100644 --- a/src/directives/attributes/wp-class.php +++ b/src/directives/attributes/wp-class.php @@ -1,6 +1,6 @@ is_tag_closer() ) { diff --git a/src/directives/attributes/wp-style.php b/src/directives/attributes/wp-style.php index 8019a9f6..2d227029 100644 --- a/src/directives/attributes/wp-style.php +++ b/src/directives/attributes/wp-style.php @@ -1,6 +1,6 @@ is_tag_closer() ) { From 4929bd0ba0f887475714dc6a9687425fc2d9241c Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Thu, 26 Jan 2023 15:08:49 +0100 Subject: [PATCH 10/10] Comment-out non-existing import --- phpunit/directives/attributes/wp-context.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit/directives/attributes/wp-context.php b/phpunit/directives/attributes/wp-context.php index 30529bef..f3460cb2 100644 --- a/phpunit/directives/attributes/wp-context.php +++ b/phpunit/directives/attributes/wp-context.php @@ -3,7 +3,7 @@ * wp-context attribute directive test. */ -require_once __DIR__ . '/../../../src/directives/attributes/wp-context.php'; +// require_once __DIR__ . '/../../../src/directives/attributes/wp-context.php'; // TODO require_once __DIR__ . '/../../../src/directives/class-wp-directive-context.php';