Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelooblan2016 committed Nov 21, 2023
1 parent 0f27a4f commit 2929794
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/AiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Orchestra\Testbench\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Support\Facades\Http;
use Marxolity\OpenAi\Providers\OpenAIServiceProvider;
use Marxolity\OpenAi\OpenAIServiceProvider;
use Marxolity\OpenAi\Facades\OpenAi;
use Mockery\MockInterface;
use Arr;
Expand All @@ -21,6 +21,11 @@ protected function getPackageProviders($app)
return [OpenAIServiceProvider::class];
}

protected function configLoad()
{
$this->app['config']->set('open-ai.api_key', 'api-key');
}

public function response()
{
return [
Expand All @@ -47,7 +52,7 @@ public function response()

public function testAiResponseArray()
{
$this->app['config']->set('ai.open_ai.api_key', 'api-key');
$this->configLoad();

Http::fake([
'*' => Http::response( $this->response() ),
Expand All @@ -62,7 +67,7 @@ public function testAiResponseArray()

public function testAiResponseJson()
{
$this->app['config']->set('ai.open_ai.api_key', 'api-key');
$this->configLoad();

Http::fake([
'*' => Http::response( $this->response() ),
Expand All @@ -77,7 +82,7 @@ public function testAiResponseJson()

public function testAiResponseXml()
{
$this->app['config']->set('ai.open_ai.api_key', 'api-key');
$this->configLoad();

Http::fake([
'*' => Http::response( $this->response() ),
Expand All @@ -92,7 +97,7 @@ public function testAiResponseXml()

public function testAiSend()
{
$this->app['config']->set('ai.open_ai.api_key', 'api-key');
$this->configLoad();

Http::fake([
'*' => Http::response( $this->response() ),
Expand Down

0 comments on commit 2929794

Please sign in to comment.