Skip to content

Commit bec5625

Browse files
Merge pull request Ashishkumbhar01#60 from CodeWithSushil/2.x
Update 2.x
2 parents 17da23e + a0e57c6 commit bec5625

File tree

12 files changed

+90
-79
lines changed

12 files changed

+90
-79
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ composer.lock export-ignore
4343
.editorconfig export-ignore
4444
.env.example export-ignore
4545
LICENSE export-ignore
46+
/.phpunit.cache/ export-ignore

.github/workflows/tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ "2.x" ]
6+
pull_request:
7+
branches: [ "2.x" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Validate composer.json and composer.lock
21+
run: composer validate --strict
22+
23+
- name: Cache Composer packages
24+
id: composer-cache
25+
uses: actions/cache@v3
26+
with:
27+
path: vendor
28+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
29+
restore-keys: |
30+
${{ runner.os }}-php-
31+
32+
- name: Install dependencies
33+
run: composer install --prefer-dist --no-progress
34+
35+
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
36+
# Docs: https://getcomposer.org/doc/articles/scripts.md
37+
38+
- name: Run test suite
39+
run: composer run-script test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.env
22
/vendor/
33
composer.lock
4-
4+
.phpunit.cache/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![Supabase](https://getlogo.net/wp-content/uploads/2020/11/supabase-logo-vector.png)
22

3-
3+
![Tests](https://github.com/CodeWithSushil/supabase-client/actions/workflows/tests.yml/badge.svg)
44
![Packagist Downloads](https://img.shields.io/packagist/dt/supabase-php/supabase-client?style=for-the-badge&logo=composer)
55
![GitHub Release](https://img.shields.io/github/v/release/Ashishkumbhar01/supabase-php?style=for-the-badge)
66
![GitHub License](https://img.shields.io/github/license/Ashishkumbhar01/supabase-php?style=for-the-badge)

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"jerome/fetch-php": "^2.0"
1616
},
1717
"require-dev": {
18-
"pestphp/pest": "^3.8",
19-
"phpstan/phpstan": "^2.1"
18+
"phpstan/phpstan": "^2.1",
19+
"phpunit/phpunit": "^12.1"
2020
},
2121
"license": "MIT",
2222
"autoload": {
@@ -55,11 +55,10 @@
5555
"post-root-package-install": [
5656
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
5757
],
58-
"test:unit": "pest --colors=always --parallel",
59-
"test:types": "phpstan analyse --ansi",
58+
"unit": "phpunit",
59+
"types": "phpstan analyse --ansi",
6060
"test": [
61-
"@test:unit",
62-
"@test:types"
61+
"@unit"
6362
]
6463
},
6564
"minimum-stability": "dev",

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ parameters:
22
level: max
33
paths:
44
- src
5+
- tests
56

67
reportUnmatchedIgnoredErrors: true

phpunit.xml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,23 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
>
5+
cacheDirectory=".phpunit.cache"
6+
executionOrder="depends,defects"
7+
requireCoverageMetadata="true"
8+
beStrictAboutCoverageMetadata="true"
9+
beStrictAboutOutputDuringTests="true"
10+
displayDetailsOnPhpunitDeprecations="true"
11+
failOnPhpunitDeprecation="true"
12+
failOnRisky="true"
13+
failOnWarning="true" colors="true">
714
<testsuites>
8-
<testsuite name="Test Suite">
9-
<directory suffix="Test.php">./tests</directory>
15+
<testsuite name="default">
16+
<directory>tests</directory>
1017
</testsuite>
1118
</testsuites>
12-
<source>
19+
20+
<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
1321
<include>
14-
<directory>app</directory>
1522
<directory>src</directory>
1623
</include>
1724
</source>

tests/Feature/ExampleTest.php

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/Pest.php

Lines changed: 0 additions & 45 deletions
This file was deleted.

tests/SupabaseTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
declare(strict_types=1);
3+
namespace Tests;
4+
5+
use PHPUnit\Framework\Attributes\CoversClass;
6+
use PHPUnit\Framework\Attributes\Test;
7+
use PHPUnit\Framework\TestCase;
8+
use Supabase\Client\Functions as Supabase;
9+
use Dotenv\Dotenv;
10+
11+
#[CoversClass(Functions::class)]
12+
class SupabaseTest extends TestCase
13+
{
14+
#[Test]
15+
public function connected()
16+
{
17+
$dotenv = Dotenv::createImmutable(__DIR__);
18+
$dotenv->safeLoad();
19+
20+
$config = [
21+
'url' => $_ENV['URL'],
22+
'apikey' => $_ENV['APIKEY']
23+
];
24+
25+
$client = new Supabase($config['url'], $config['apikey']);
26+
$this->assertInstanceOf(Supabase::class, $client);
27+
// $this->assertTrue($client->getAllData('Users'));
28+
}
29+
}

0 commit comments

Comments
 (0)