Commit 348fc7da authored by Ahmad Khader's avatar Ahmad Khader 😫
Browse files

Fix tests

parent 8097088e
Loading
Loading
Loading
Loading
Loading
+14 −0
Changes for tests/src/Unit/Plugin/AiFunctionCall/FileToTextAccessTest.php: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ namespace Drupal\Tests\ai_file_to_text\Unit\Plugin\AiFunctionCall;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\ai\Base\FunctionCallBase;
use Drupal\ai_file_to_text\Plugin\AiFunctionCall\FileToText;
use Drupal\file\FileInterface;
use Drupal\Tests\UnitTestCase;
@@ -25,6 +26,19 @@ use PHPUnit\Framework\Attributes\Group;
#[Group('ai_file_to_text')]
class FileToTextAccessTest extends UnitTestCase {

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    parent::setUp();
    // The AiFunctionCall plugins are a soft dependency: drupal/ai is not in
    // this module's composer requirements, so it is absent from CI and the
    // plugin's base class cannot be autoloaded there. Skip rather than fatal.
    if (!class_exists(FunctionCallBase::class)) {
      $this->markTestSkipped('Requires drupal/ai, which is a soft dependency of this module.');
    }
  }

  /**
   * Builds the plugin with mocked dependencies and fixed context values.
   *