feat: save admin sync settings
This commit is contained in:
@@ -4,6 +4,7 @@ namespace WPContentSync\Tests\Unit;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use WPContentSync\Admin\FileImportController;
|
||||
use WPContentSync\Admin\SettingsController;
|
||||
use WPContentSync\Content\ContentHandlerRegistry;
|
||||
use WPContentSync\Content\ContentRecordNormalizer;
|
||||
use WPContentSync\Content\MediaContentHandler;
|
||||
@@ -51,6 +52,15 @@ class PluginTest extends TestCase {
|
||||
);
|
||||
}
|
||||
|
||||
public function test_it_registers_settings_controller(): void {
|
||||
$container = $this->getPluginContainer( Plugin::create() );
|
||||
|
||||
self::assertInstanceOf(
|
||||
SettingsController::class,
|
||||
$container->get( SettingsController::class )
|
||||
);
|
||||
}
|
||||
|
||||
public function test_it_registers_rest_transport_services(): void {
|
||||
$container = $this->getPluginContainer( Plugin::create() );
|
||||
|
||||
@@ -85,6 +95,15 @@ class PluginTest extends TestCase {
|
||||
self::assertArrayHasKey( 'rest_api_init', $GLOBALS['wpcs_test_actions'] );
|
||||
}
|
||||
|
||||
public function test_it_hooks_settings_controller_on_register(): void {
|
||||
unset( $GLOBALS['wpcs_test_actions'] );
|
||||
|
||||
$plugin = Plugin::create();
|
||||
$plugin->register();
|
||||
|
||||
self::assertArrayHasKey( 'admin_post_wpcs_save_settings', $GLOBALS['wpcs_test_actions'] );
|
||||
}
|
||||
|
||||
private function getPluginContainer( Plugin $plugin ): Container {
|
||||
$reflection = new \ReflectionClass( $plugin );
|
||||
$property = $reflection->getProperty( 'container' );
|
||||
|
||||
Reference in New Issue
Block a user