feature: Initial commit

This commit is contained in:
Keith Solomon
2026-08-24 08:46:51 -05:00
commit 158f978021
24 changed files with 2200 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
/**
* Basic project smoke tests.
*
* @package RSS2CPT
*/
use PHPUnit\Framework\TestCase;
/**
* Verifies project-level invariants without loading WordPress.
*/
final class SmokeTest extends TestCase {
/**
* Verify the runtime supports the plugin baseline.
*/
public function test_supported_php_runtime(): void {
$this->assertTrue( version_compare( PHP_VERSION, '7.4', '>=' ) );
}
/**
* Verify the persisted option name remains stable.
*/
public function test_option_key_is_stable(): void {
$this->assertSame( 'rss2cpt_settings', RSS2CPT\Options::KEY );
}
/**
* Verify backfills use a safe bounded default.
*/
public function test_default_import_limit_is_bounded(): void {
$settings = RSS2CPT\Options::get();
$this->assertSame( 25, $settings['item_limit'] );
}
/**
* Verify ongoing imports do not inherit WordPress's long feed cache.
*/
public function test_importer_uses_short_feed_cache(): void {
$importer = new RSS2CPT\Import\Importer();
$this->assertSame( 300, $importer->filter_feed_cache_lifetime( 43200, 'https://example.test/feed.xml' ) );
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
/**
* PHPUnit bootstrap.
*
* @package RSS2CPT
*/
define( 'ABSPATH', dirname( __DIR__ ) . '/' );
define( 'MINUTE_IN_SECONDS', 60 );
/**
* Minimal option stub for isolated settings tests.
*
* @param string $option Option name.
* @param mixed $default_value Default value.
* @return mixed
*/
function get_option( $option, $default_value = false ) {
unset( $option );
return $default_value;
}
/**
* Minimal wp_parse_args stub for isolated settings tests.
*
* @param array $args Supplied values.
* @param array $defaults Default values.
* @return array
*/
function wp_parse_args( $args, $defaults = array() ) {
return array_merge( $defaults, $args );
}
require_once dirname( __DIR__ ) . '/src/Options.php';
require_once dirname( __DIR__ ) . '/src/Import/Importer.php';