Skip to content
Snippets Groups Projects

Add native block-editor support

Merged Erick Hitter requested to merge add/gutenberg-control into master
@@ -105,13 +105,16 @@ class TestClassExternalPermalinksReduxBlockEditor extends WP_UnitTestCase {
* @covers ::enqueue()
*/
public function test_enqueue() {
$asset_handle = $asset_handle = 'external-permalinks-redux';
$asset_handle = 'external-permalinks-redux';
$this->assertFalse(
wp_script_is( $asset_handle, 'enqueued' ),
'Failed to assert that script is not enqueued.'
);
remove_all_actions( 'admin_init' );
do_action( 'admin_init' );
external_permalinks_redux::get_instance()->action_admin_init();
External_Permalinks_Redux_Block_Editor::get_instance()->enqueue();
$this->assertTrue(
@@ -125,4 +128,41 @@ class TestClassExternalPermalinksReduxBlockEditor extends WP_UnitTestCase {
'Failed to assert that configuration data is added.'
);
}
/**
* Test conversion of status codes to format expected by Gutenberg's
* `SelectControl` component.
*
* @covers ::_get_status_codes()
*/
public function test__get_status_codes() {
$class = External_Permalinks_Redux_Block_Editor::get_instance();
$reflection = new \ReflectionClass( $class );
$method = $reflection->getMethod( '_get_status_codes' );
$method->setAccessible( true );
remove_all_actions( 'admin_init' );
do_action( 'admin_init' );
external_permalinks_redux::get_instance()->action_admin_init();
$this->assertEquals(
array(
array(
'label' => '-- Select --',
'value' => 0,
),
array(
'label' => 'Temporary (302)',
'value' => 302,
),
array(
'label' => 'Permanent (301)',
'value' => 301,
),
),
$method->invoke( $class ),
'Failed to assert that status codes are transformed as expected.'
);
}
}
Loading