Plugin packaging and docs
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?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']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user