5777210184
- Favorites/Messages adapters reduced to detection only; Requests keeps hot_hp_request fields, drops hp_offer mirror - Delete TMDO_HivePress_Comment_Router (read path to wpdo_comment_hp_* tables that no installer creates) - Verify: addon unit 141 OK, integration 52 OK; phpcs 41E/57W → 35E/48W - PR: PR-013
65 lines
2.0 KiB
PHP
65 lines
2.0 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* Tests for WPDO_HivePress_Favorites_Adapter.
|
|
*
|
|
* The adapter no longer mirrors favorites into a shadow table: that table was
|
|
* never created, so every mirror write failed.
|
|
*
|
|
* @covers WPDO_HivePress_Favorites_Adapter
|
|
*/
|
|
class HivePressFavoritesAdapterTest extends TestCase {
|
|
|
|
use WpdbMockTrait;
|
|
|
|
private WPDO_HivePress_Favorites_Adapter $adapter;
|
|
|
|
protected function setUp(): void {
|
|
$this->install_wpdb_mock();
|
|
WPDO_Custom_Table_Registry::reset_for_tests();
|
|
$this->adapter = new WPDO_HivePress_Favorites_Adapter();
|
|
}
|
|
|
|
public function test_implements_adapter_interface(): void {
|
|
$this->assertInstanceOf( WPDO_HivePress_Adapter::class, $this->adapter );
|
|
}
|
|
|
|
public function test_identity(): void {
|
|
$this->assertSame( 'hivepress-favorites', $this->adapter->plugin_slug() );
|
|
$this->assertSame( 'HivePress\\Favorites\\Plugin', $this->adapter->detection_class() );
|
|
$this->assertSame( 'HIVEPRESS_FAVORITES_VERSION', $this->adapter->detection_const() );
|
|
}
|
|
|
|
public function test_constants_exposed(): void {
|
|
$this->assertSame( 'hp_favorite', WPDO_HivePress_Favorites_Adapter::COMMENT_TYPE );
|
|
}
|
|
|
|
public function test_registers_no_shadow_table(): void {
|
|
$registry = WPDO_Custom_Table_Registry::instance();
|
|
$this->adapter->on_register_custom_tables( $registry );
|
|
|
|
$this->assertSame( array(), $registry->all() );
|
|
}
|
|
|
|
public function test_binds_no_comment_hooks(): void {
|
|
$GLOBALS['_wp_filter_callbacks'] = array();
|
|
|
|
$this->adapter->on_register_event_hooks();
|
|
|
|
$this->assertArrayNotHasKey( 'wp_insert_comment', $GLOBALS['_wp_filter_callbacks'] );
|
|
$this->assertArrayNotHasKey( 'deleted_comment', $GLOBALS['_wp_filter_callbacks'] );
|
|
}
|
|
|
|
public function test_score_aggregates_to_perfect_ten(): void {
|
|
$score = $this->adapter->suitability_score();
|
|
$this->assertSame( 10.0, $score['aggregate'] );
|
|
}
|
|
|
|
public function test_migrations_is_empty(): void {
|
|
$this->assertSame( array(), $this->adapter->migrations() );
|
|
}
|
|
}
|