feat: wire file transport services

This commit is contained in:
Keith Solomon
2026-04-26 20:37:35 -05:00
parent 76b614e9e3
commit 90b56e13bb
4 changed files with 86 additions and 0 deletions
+15
View File
@@ -3,8 +3,10 @@
namespace WPContentSync\Tests\Unit;
use PHPUnit\Framework\TestCase;
use WPContentSync\Admin\FileImportController;
use WPContentSync\Container;
use WPContentSync\Plugin;
use WPContentSync\Transport\FileTransportInterface;
use WPContentSync\Url\MetadataUrlTransformer;
use WPContentSync\Url\UrlTransformer;
@@ -21,6 +23,19 @@ class PluginTest extends TestCase {
self::assertSame( $metadata_transformer, $container->get( MetadataUrlTransformer::class ) );
}
public function test_it_registers_file_transport_services(): void {
$container = $this->getPluginContainer( Plugin::create() );
self::assertInstanceOf(
FileTransportInterface::class,
$container->get( FileTransportInterface::class )
);
self::assertInstanceOf(
FileImportController::class,
$container->get( FileImportController::class )
);
}
private function getPluginContainer( Plugin $plugin ): Container {
$reflection = new \ReflectionClass( $plugin );
$property = $reflection->getProperty( 'container' );
+26
View File
@@ -395,6 +395,32 @@ if ( ! function_exists( 'add_query_arg' ) ) {
}
}
if ( ! function_exists( 'wp_nonce_field' ) ) {
/**
* Minimal nonce field renderer for unit tests.
*
* @param string $action Nonce action.
* @param string $name Field name.
* @return void
*/
function wp_nonce_field( $action, $name ) {
echo '<input type="hidden" name="' . esc_attr( $name ) . '" value="' . esc_attr( $action ) . '" />';
}
}
if ( ! function_exists( 'submit_button' ) ) {
/**
* Minimal submit button renderer for unit tests.
*
* @param string $text Button text.
* @param string $type Button type.
* @return void
*/
function submit_button( $text, $type = 'primary' ) {
echo '<button class="button button-' . esc_attr( $type ) . '" type="submit">' . esc_html( $text ) . '</button>';
}
}
if ( ! function_exists( 'wp_die' ) ) {
/**
* Minimal WordPress die handler for unit tests.