<?php
/**
 * Configuration Test
 *
 * @package Care_API\Tests\Unit
 */

namespace Care_API\Tests\Unit;

/**
 * Test basic configuration setup.
 */
class ConfigTest extends \Care_API_Test_Case {

	/**
	 * Test that WordPress test environment is set up correctly.
	 */
	public function test_wordpress_environment() {
		$this->assertTrue( defined( 'WP_TESTS_DIR' ) || function_exists( 'wp_loaded' ) );
		$this->assertTrue( function_exists( 'add_action' ) );
		$this->assertTrue( function_exists( 'wp_create_user' ) );
	}

	/**
	 * Test that KiviCare API constants are defined.
	 */
	public function test_kivicare_api_constants() {
		$this->assertTrue( defined( 'KIVICARE_API_TESTS' ) );
		$this->assertEquals( true, KIVICARE_API_TESTS );
	}

	/**
	 * Test that we have required test users.
	 */
	public function test_test_users_created() {
		$this->assertNotEmpty( $this->admin_user );
		$this->assertNotEmpty( $this->doctor_user );
		$this->assertNotEmpty( $this->patient_user );
		$this->assertNotEmpty( $this->receptionist_user );
	}

	/**
	 * Test that REST server is initialized.
	 */
	public function test_rest_server_initialized() {
		$this->assertNotNull( $this->server );
		$this->assertInstanceOf( 'WP_REST_Server', $this->server );
	}
}