Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
dependency-versions: ${{ matrix.dependency }}

- name: Integration Tests
run: php ./vendor/bin/simple-phpunit
run: php ./vendor/bin/phpunit
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 1 addition & 2 deletions src/OpenAIBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
34 changes: 34 additions & 0 deletions tests/OpenAIBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
Loading