Skip to content
Snippets Groups Projects
Commit 11b10e1c authored by Erick Hitter's avatar Erick Hitter
Browse files

Test coverage

parent e8df00ba
No related branches found
No related tags found
1 merge request!14Add native block-editor support
Pipeline #4811 failed with stages
in 2 minutes and 12 seconds
...@@ -17,7 +17,43 @@ class TestClassExternalPermalinksReduxBlockEditor extends WP_UnitTestCase { ...@@ -17,7 +17,43 @@ class TestClassExternalPermalinksReduxBlockEditor extends WP_UnitTestCase {
* @covers ::register_meta() * @covers ::register_meta()
*/ */
public function test_register_meta() { public function test_register_meta() {
$this->markTestIncomplete( 'This test has not been implemented.' ); global $wp_meta_keys;
$wp_meta_keys = null;
$this->assertFalse(
registered_meta_key_exists(
'post',
external_permalinks_redux::get_instance()->meta_key_target
),
'Failed to assert that "target" meta key is not registered.'
);
$this->assertFalse(
registered_meta_key_exists(
'post',
external_permalinks_redux::get_instance()->meta_key_type
),
'Failed to assert that "type" meta key is not registered.'
);
External_Permalinks_Redux_Block_Editor::get_instance()->register_meta();
$this->assertTrue(
registered_meta_key_exists(
'post',
external_permalinks_redux::get_instance()->meta_key_target
),
'Failed to assert that "target" meta key is registered.'
);
$this->assertTrue(
registered_meta_key_exists(
'post',
external_permalinks_redux::get_instance()->meta_key_type
),
'Failed to assert that "type" meta key is registered.'
);
} }
/** /**
...@@ -26,7 +62,41 @@ class TestClassExternalPermalinksReduxBlockEditor extends WP_UnitTestCase { ...@@ -26,7 +62,41 @@ class TestClassExternalPermalinksReduxBlockEditor extends WP_UnitTestCase {
* @covers ::allow_meta_updates() * @covers ::allow_meta_updates()
*/ */
public function test_allow_meta_updates() { public function test_allow_meta_updates() {
$this->markTestIncomplete( 'This test has not been implemented.' ); $this->assertTrue(
External_Permalinks_Redux_Block_Editor::get_instance()->allow_meta_updates(
true,
'_a_random_key',
'term'
),
'Failed to assert that a term\'s key is not modified..'
);
$this->assertTrue(
External_Permalinks_Redux_Block_Editor::get_instance()->allow_meta_updates(
true,
'_a_random_key',
'post'
),
'Failed to assert that unrelated key\'s protection is not modified.'
);
$this->assertFalse(
External_Permalinks_Redux_Block_Editor::get_instance()->allow_meta_updates(
true,
external_permalinks_redux::get_instance()->meta_key_target,
'post'
),
'Failed to assert that "target" key is not protected.'
);
$this->assertFalse(
External_Permalinks_Redux_Block_Editor::get_instance()->allow_meta_updates(
true,
external_permalinks_redux::get_instance()->meta_key_type,
'post'
),
'Failed to assert that "type" key is not protected.'
);
} }
/** /**
...@@ -35,6 +105,24 @@ class TestClassExternalPermalinksReduxBlockEditor extends WP_UnitTestCase { ...@@ -35,6 +105,24 @@ class TestClassExternalPermalinksReduxBlockEditor extends WP_UnitTestCase {
* @covers ::enqueue() * @covers ::enqueue()
*/ */
public function test_enqueue() { public function test_enqueue() {
$this->markTestIncomplete( 'This test has not been implemented.' ); $asset_handle = $asset_handle = 'external-permalinks-redux';
$this->assertFalse(
wp_script_is( $asset_handle, 'enqueued' ),
'Failed to assert that script is not enqueued.'
);
External_Permalinks_Redux_Block_Editor::get_instance()->enqueue();
$this->assertTrue(
wp_script_is( $asset_handle, 'enqueued' ),
'Failed to assert that script is enqueued.'
);
$this->assertStringContainsString(
'externalPermalinksReduxConfig',
wp_scripts()->get_data( $asset_handle, 'data' ),
'Failed to assert that configuration data is added.'
);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment