Skip to content

Commit

Permalink
Getting integration tests to run again.
Browse files Browse the repository at this point in the history
  • Loading branch information
tehnorm committed Apr 25, 2023
1 parent 30fa607 commit 7e56398
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["supabase","postgrest", "postgrest-php"],
"homepage": "https://github.com/supabase-community/postgrest-php",
"autoload": {
"psr-0": { "": "src/" },
"psr-0": { "": "src/" },
"psr-4": {
"Supabase\\Postgrest\\": "src/"
}
Expand Down
4 changes: 2 additions & 2 deletions src/Postgrest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
namespace Supabase\Postgrest;

use Supabase\Util\PostgrestError;
use Supabase\Util\Request;
use Supabase\Postgrest\Util\PostgrestError;
use Supabase\Postgrest\Util\Request;

class Postgrest
{
Expand Down
2 changes: 1 addition & 1 deletion src/PostgrestClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Supabase\Postgrest;

use Spatie\Url\Url;
use Supabase\Util\Constants;
use Supabase\Postgrest\Util\Constants;

class PostgrestClient
{
Expand Down
2 changes: 2 additions & 0 deletions src/PostgrestQuery.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Supabase\Postgrest;

use Supabase\Postgrest\PostgrestFilter;

class PostgrestQuery
{
public $url;
Expand Down
2 changes: 1 addition & 1 deletion src/Util/Constants.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Supabase\Util;
namespace Supabase\Postgrest\Util;

class Constants
{
Expand Down
2 changes: 1 addition & 1 deletion src/Util/EnvSetup.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Supabase\Util;
namespace Supabase\Postgrest\Util;

use Dotenv\Dotenv;

Expand Down
2 changes: 1 addition & 1 deletion src/Util/PostgrestApiError.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Supabase\Util;
namespace Supabase\Postgrest\Util;

class PostgrestApiError extends PostgrestError
{
Expand Down
2 changes: 1 addition & 1 deletion src/Util/PostgrestError.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Supabase\Util;
namespace Supabase\Postgrest\Util;

class PostgrestError extends \Exception
{
Expand Down
2 changes: 1 addition & 1 deletion src/Util/PostgrestUnknownError.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Supabase\Util;
namespace Supabase\Postgrest\Util;

class PostgrestUnknownError extends PostgrestError
{
Expand Down
2 changes: 1 addition & 1 deletion src/Util/Request.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Supabase\Util;
namespace Supabase\Postgrest\Util;

use Psr\Http\Message\ResponseInterface;

Expand Down
20 changes: 9 additions & 11 deletions tests/integration/PostgrestClientTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

declare(strict_types=1);
require 'vendor/autoload.php';

use PHPUnit\Framework\TestCase;
use Supabase\Postgrest\PostgrestClient;
use Supabase\Postgrest\Util\EnvSetup;

final class PostgrestClientTest extends TestCase
{
Expand All @@ -11,16 +13,12 @@ final class PostgrestClientTest extends TestCase
public function setup(): void
{
parent::setUp();
\Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv = \Dotenv\Dotenv::createUnsafeImmutable(__DIR__, '/../../.env.test');
$dotenv->load();
$api_key = getenv('API_KEY');
$reference_id = getenv('REFERENCE_ID');
$scheme = 'https://';
$domain = '.supabase.co/';
$path = 'rest/v1/';
$opts = [];
$this->client = new PostgrestClient($reference_id, $api_key, $opts, $domain, $scheme, $path);

$keys = EnvSetup::env(__DIR__.'/../');
$api_key = $keys['API_KEY'];
$reference_id = $keys['REFERENCE_ID'];

$this->client = new PostgrestClient($reference_id, $api_key);
}

public function testBulkProcessing(): void
Expand Down
20 changes: 9 additions & 11 deletions tests/integration/PostgrestTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

declare(strict_types=1);
require 'vendor/autoload.php';

use PHPUnit\Framework\TestCase;
use Supabase\Postgrest\PostgrestClient;
use Supabase\Postgrest\Util\EnvSetup;

final class PostgrestTest extends TestCase
{
Expand All @@ -11,16 +13,12 @@ final class PostgrestTest extends TestCase
public function setup(): void
{
parent::setUp();
\Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv = \Dotenv\Dotenv::createUnsafeImmutable(__DIR__, '/../../.env.test');
$dotenv->load();
$api_key = getenv('API_KEY');
$reference_id = getenv('REFERENCE_ID');
$scheme = 'https://';
$domain = '.supabase.co/';
$path = 'rest/v1/';
$opts = [];
$this->client = new PostgrestClient($reference_id, $api_key, $opts, $domain, $scheme, $path);

$keys = EnvSetup::env(__DIR__.'/../');
$api_key = $keys['API_KEY'];
$reference_id = $keys['REFERENCE_ID'];

$this->client = new PostgrestClient($reference_id, $api_key);
}

/**
Expand Down

0 comments on commit 7e56398

Please sign in to comment.