feat: wire rest transport services

This commit is contained in:
Keith Solomon
2026-04-28 13:04:39 -05:00
parent e3d48f2383
commit 8c3773f040
3 changed files with 58 additions and 0 deletions
+30
View File
@@ -6,11 +6,19 @@ use PHPUnit\Framework\TestCase;
use WPContentSync\Admin\FileImportController;
use WPContentSync\Container;
use WPContentSync\Plugin;
use WPContentSync\Rest\RestPackageController;
use WPContentSync\Transport\FileTransportInterface;
use WPContentSync\Transport\RestTransportClient;
use WPContentSync\Url\MetadataUrlTransformer;
use WPContentSync\Url\UrlTransformer;
class PluginTest extends TestCase {
protected function tearDown(): void {
unset( $GLOBALS['wpcs_test_actions'] );
parent::tearDown();
}
public function test_it_registers_url_transformation_services(): void {
$container = $this->getPluginContainer( Plugin::create() );
@@ -36,6 +44,28 @@ class PluginTest extends TestCase {
);
}
public function test_it_registers_rest_transport_services(): void {
$container = $this->getPluginContainer( Plugin::create() );
self::assertInstanceOf(
RestTransportClient::class,
$container->get( RestTransportClient::class )
);
self::assertInstanceOf(
RestPackageController::class,
$container->get( RestPackageController::class )
);
}
public function test_it_hooks_rest_package_controller_on_register(): void {
unset( $GLOBALS['wpcs_test_actions'] );
$plugin = Plugin::create();
$plugin->register();
self::assertArrayHasKey( 'rest_api_init', $GLOBALS['wpcs_test_actions'] );
}
private function getPluginContainer( Plugin $plugin ): Container {
$reflection = new \ReflectionClass( $plugin );
$property = $reflection->getProperty( 'container' );