This commit is contained in:
alorig
2025-12-01 09:32:06 +05:00
parent aeaac01990
commit 71a38435b1
46 changed files with 75 additions and 17130 deletions

View File

@@ -1,36 +0,0 @@
<?php
/**
* Basic unit test for site-metadata endpoint
*
* @package Igny8Bridge
*/
class Test_Site_Metadata_Endpoint extends WP_UnitTestCase {
public function test_site_metadata_endpoint_returns_success() {
// Ensure connection enabled
update_option('igny8_connection_enabled', 1);
// Create a fake API key so permission checks pass via Igny8API
update_option('igny8_api_key', 'test-api-key-123');
update_option('igny8_access_token', 'test-api-key-123');
// Build request
$request = new WP_REST_Request('GET', '/igny8/v1/site-metadata/');
$request->set_header('Authorization', 'Bearer test-api-key-123');
$server = rest_get_server();
$response = $server->dispatch($request);
$this->assertEquals(200, $response->get_status());
$data = $response->get_data();
$this->assertNotEmpty($data);
$this->assertArrayHasKey('success', $data);
$this->assertTrue($data['success']);
$this->assertArrayHasKey('data', $data);
$this->assertArrayHasKey('post_types', $data['data']);
$this->assertArrayHasKey('taxonomies', $data['data']);
}
}