diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 87668e5..ad0de0b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,4 +39,4 @@ jobs: dependency-versions: ${{ matrix.dependency }} - name: Integration Tests - run: php ./vendor/bin/simple-phpunit + run: php ./vendor/bin/phpunit diff --git a/composer.json b/composer.json index e7b26ce..3268188 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "laravel/pint": "^1.24.0", "phpstan/phpstan": "^2.1.22", "rector/rector": "^2.1.5", - "symfony/phpunit-bridge": "^6.4.25|^7.3|^8.0", + "phpunit/phpunit": "^11|^12", "symfony/framework-bundle": "^6.4|^7.3|^8.0" }, "autoload": { diff --git a/src/OpenAIBundle.php b/src/OpenAIBundle.php index 9d78a06..4974cee 100644 --- a/src/OpenAIBundle.php +++ b/src/OpenAIBundle.php @@ -28,8 +28,7 @@ public function configure(DefinitionConfigurator $definition): void $children ->scalarNode('api_key') ->defaultValue('%env(OPENAI_API_KEY)%') - ->info('OpenAI API Key used to authenticate with the OpenAI API') - ->isRequired(); + ->info('OpenAI API Key used to authenticate with the OpenAI API'); $children ->scalarNode('organization') ->info('OpenAI API Organization used to authenticate with the OpenAI API') diff --git a/tests/OpenAIBundleTest.php b/tests/OpenAIBundleTest.php index 960339f..2b7df64 100644 --- a/tests/OpenAIBundleTest.php +++ b/tests/OpenAIBundleTest.php @@ -7,10 +7,12 @@ use OpenAI\Client; use OpenAI\Contracts\ClientContract; use OpenAI\Symfony\OpenAIBundle; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; +use Symfony\Component\ErrorHandler\ErrorHandler; use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\HttpClient\Response\MockResponse; use Symfony\Component\HttpKernel\Kernel; @@ -19,6 +21,38 @@ final class OpenAIBundleTest extends TestCase { + public static function setUpBeforeClass(): void + { + ErrorHandler::register(null, false); + } + + #[DoesNotPerformAssertions] + public function test_defaults(): void + { + $kernel = new class('test', true) extends Kernel + { + use MicroKernelTrait; + + public function registerBundles(): iterable + { + yield new FrameworkBundle; + yield new OpenAIBundle; + } + + protected function configureContainer(ContainerConfigurator $container): void + { + $container->extension('framework', [ + 'secret' => 'S0ME_SECRET', + 'http_method_override' => false, + 'handle_all_throwables' => true, + 'php_errors' => ['log' => true], + ]); + } + }; + + $kernel->boot(); + } + public function test_service(): void { $kernel = new class('test', true) extends Kernel