MDL-82627 core: Add testsuite for AI

Originally implemented in MDL-80889
This commit is contained in:
Huong Nguyen 2024-08-14 09:53:35 +07:00
parent 67e6898853
commit 8186e6ce25
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
3 changed files with 17 additions and 1 deletions

View File

@ -53,10 +53,13 @@ final class manager_test extends \advanced_testcase {
$this->expectExceptionMessage('Plugin name does not start with \'aiprovider_\' or \'aiplacement_\': bar');
$method->invoke($manager, 'bar');
}
/**
* Test get_supported_actions.
*/
public function test_get_supported_actions(): void {
// TODO: Enable this test in MDL-80894.
$this->markTestSkipped('MDL-80894');
$manager = new manager();
$actions = $manager->get_supported_actions('aiprovider_openai');
@ -72,6 +75,8 @@ final class manager_test extends \advanced_testcase {
* Test get_providers_for_actions.
*/
public function test_get_providers_for_actions(): void {
// TODO: Enable this test in MDL-80894.
$this->markTestSkipped('MDL-80894');
$this->resetAfterTest();
set_config('enabled', 1, 'aiprovider_openai');
@ -98,7 +103,6 @@ final class manager_test extends \advanced_testcase {
// Assert that there is no provider for the generate text action.
$this->assertCount(0, $providers['core_ai\\aiactions\\generate_text']);
$this->assertCount(1, $providers['core_ai\\aiactions\\summarise_text']);
}
/**
@ -139,6 +143,8 @@ final class manager_test extends \advanced_testcase {
* Test process_action.
*/
public function test_process_action(): void {
// TODO: Enable this test in MDL-80894.
$this->markTestSkipped('MDL-80894');
$this->resetAfterTest();
// Enable the providers.
@ -280,6 +286,8 @@ final class manager_test extends \advanced_testcase {
* Test store_action_result.
*/
public function test_store_action_result(): void {
// TODO: Enable this test in MDL-80894.
$this->markTestSkipped('MDL-80894');
$this->resetAfterTest();
global $DB;
@ -334,6 +342,8 @@ final class manager_test extends \advanced_testcase {
* Test call_action_provider.
*/
public function test_call_action_provider(): void {
// TODO: Enable this test in MDL-80894.
$this->markTestSkipped('MDL-80894');
$contextid = 1;
$userid = 1;
$prompttext = 'This is a test prompt';

View File

@ -1559,6 +1559,8 @@ final class provider_test extends \advanced_testcase {
* Test get_name.
*/
public function test_get_name(): void {
// TODO: Enable this test in MDL-80894.
$this->markTestSkipped('MDL-80894');
$provider = new \aiprovider_openai\provider();
$this->assertEquals(get_string('pluginname', 'aiprovider_openai'), $provider->get_name());

View File

@ -290,6 +290,10 @@
<directory suffix="_test.php">communication/tests</directory>
<exclude>communication/tests/classes</exclude>
</testsuite>
<testsuite name="core_ai_testsuite">
<directory suffix="_test.php">ai/tests</directory>
<exclude>ai/tests/classes</exclude>
</testsuite>
<!--Plugin suites: use admin/tool/phpunit/cli/util.php to build phpunit.xml from
phpunit.xml.dist with up-to-date list of plugins in current install-->