diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml
new file mode 100644
index 0000000..b4979d6
--- /dev/null
+++ b/.github/workflows/dependabot-auto-merge.yml
@@ -0,0 +1,33 @@
+name: dependabot-auto-merge
+on: pull_request_target
+
+permissions:
+ pull-requests: write
+ contents: write
+
+jobs:
+ dependabot:
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ if: ${{ github.actor == 'dependabot[bot]' }}
+ steps:
+
+ - name: Dependabot metadata
+ id: metadata
+ uses: dependabot/fetch-metadata@v2.3.0
+ with:
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
+
+ - name: Auto-merge Dependabot PRs for semver-minor updates
+ if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
+ run: gh pr merge --auto --merge "$PR_URL"
+ env:
+ PR_URL: ${{github.event.pull_request.html_url}}
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
+
+ - name: Auto-merge Dependabot PRs for semver-patch updates
+ if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
+ run: gh pr merge --auto --merge "$PR_URL"
+ env:
+ PR_URL: ${{github.event.pull_request.html_url}}
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml
new file mode 100644
index 0000000..1ec8dbf
--- /dev/null
+++ b/.github/workflows/fix-php-code-style-issues.yml
@@ -0,0 +1,28 @@
+name: Fix PHP code style issues
+
+on:
+ push:
+ paths:
+ - '**.php'
+
+permissions:
+ contents: write
+
+jobs:
+ php-code-styling:
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.head_ref }}
+
+ - name: Fix PHP code style issues
+ uses: aglipanci/laravel-pint-action@2.5
+
+ - name: Commit changes
+ uses: stefanzweifel/git-auto-commit-action@v5
+ with:
+ commit_message: Fix styling
diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml
index 97545d8..734da39 100644
--- a/.github/workflows/phpstan.yml
+++ b/.github/workflows/phpstan.yml
@@ -5,27 +5,24 @@ on:
paths:
- '**.php'
- 'phpstan.neon.dist'
- pull_request:
- paths:
- - '**.php'
- - 'phpstan.neon.dist'
-
+ - '.github/workflows/phpstan.yml'
jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
+ timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
- php-version: '8.0'
+ php-version: '8.3'
coverage: none
- name: Install composer dependencies
- uses: ramsey/composer-install@v1
+ uses: ramsey/composer-install@v3
- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
diff --git a/.github/workflows/pint.yml b/.github/workflows/pint.yml
deleted file mode 100644
index 826a2a7..0000000
--- a/.github/workflows/pint.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-name: PHP Linting (Pint)
-on:
- workflow_dispatch:
- push:
- branches-ignore:
- - "dependabot/npm_and_yarn/*"
-jobs:
- phplint:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 2
- - name: "laravel-pint"
- uses: aglipanci/laravel-pint-action@0.1.0
- with:
- preset: laravel
-
- - name: Commit changes
- uses: stefanzweifel/git-auto-commit-action@v4
- with:
- commit_message: PHP Linting (Pint)
- skip_fetch: true
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index 3966abf..3eedf98 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -1,45 +1,29 @@
name: Run Tests - Current
on:
- - push
- - pull_request
+ push:
+ paths:
+ - '**.php'
+ - '.github/workflows/run-tests.yml'
+ - 'phpunit.xml.dist'
+ - 'composer.json'
+ - 'composer.lock'
jobs:
test:
- runs-on: ubuntu-latest
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 5
strategy:
- fail-fast: false
+ fail-fast: true
matrix:
- php: [8.3, 8.2, 8.1, 8.0, 7.4]
- laravel: ['8.*', '9.*', '10.*', '11.*']
- dependency-version: [prefer-lowest, prefer-stable]
- exclude:
- - laravel: 10.*
- php: 8.0
- - laravel: 10.*
- php: 7.4
- - laravel: 9.*
- php: 7.4
- - laravel: 8.*
- php: 8.1
- - laravel: 8.*
- php: 8.2
- - laravel: 8.*
- php: 8.3
- - laravel: 11.*
- php: 8.1
- - laravel: 11.*
- php: 8.0
- - laravel: 11.*
- php: 7.4
+ os: [ubuntu-latest]
+ php: [8.4, 8.3, 8.2]
+ laravel: ['11.*', '12.*']
+ stability: [prefer-lowest, prefer-stable]
include:
- - laravel: 10.*
- testbench: 8.*
- - laravel: 9.*
- testbench: 7.*
- - laravel: 8.*
- testbench: 6.*
+ - laravel: 12.*
+ testbench: 10.*
- laravel: 11.*
testbench: 9.*
@@ -59,14 +43,24 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
- coverage: pcov
+ extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
+ coverage: none
+
+ - name: Setup problem matchers
+ run: |
+ echo "::add-matcher::${{ runner.tool_cache }}/php.json"
+ echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
- composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "symfony/console:>=4.3.4" "mockery/mockery:^1.3.2" --no-interaction --no-update
- composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- cp .env.example .env
+ composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
+ composer update --${{ matrix.stability }} --prefer-dist --no-interaction
+
+ - name: Copy .env.example
+ run: cp .env.example .env
+
+ - name: List Installed Dependencies
+ run: composer show -D
- name: Execute tests
- run: vendor/bin/phpunit
+ run: vendor/bin/pest
diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml
new file mode 100644
index 0000000..39de30d
--- /dev/null
+++ b/.github/workflows/update-changelog.yml
@@ -0,0 +1,32 @@
+name: "Update Changelog"
+
+on:
+ release:
+ types: [released]
+
+permissions:
+ contents: write
+
+jobs:
+ update:
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ ref: main
+
+ - name: Update Changelog
+ uses: stefanzweifel/changelog-updater-action@v1
+ with:
+ latest-version: ${{ github.event.release.name }}
+ release-notes: ${{ github.event.release.body }}
+
+ - name: Commit updated CHANGELOG
+ uses: stefanzweifel/git-auto-commit-action@v5
+ with:
+ branch: main
+ commit_message: Update CHANGELOG
+ file_pattern: CHANGELOG.md
diff --git a/composer.json b/composer.json
index e848b5c..d2685e7 100755
--- a/composer.json
+++ b/composer.json
@@ -16,18 +16,23 @@
}
],
"require": {
- "php": "^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3",
- "guzzlehttp/guzzle": "~6.0 || ~7.0",
- "illuminate/support": "5.7.* || 5.8.* ||^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0",
- "symfony/dotenv": "^4.2 || ^5.1 || ^7.0"
+ "php": "^8.2 || ^8.3 || ^8.4",
+ "guzzlehttp/guzzle": "~7.0",
+ "illuminate/support": "^10.0 || ^11.0 || ^12.0",
+ "symfony/dotenv": "^6.0 || ^7.0"
},
"require-dev": {
- "mockery/mockery": "^1.4",
- "orchestra/testbench": "^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
- "phpstan/extension-installer": "^1.1",
- "phpstan/phpstan-deprecation-rules": "^1.0",
- "phpstan/phpstan-phpunit": "^1.0",
- "phpunit/phpunit": "^8.4 || ^9.3.3 || ^10.0"
+ "larastan/larastan": "^2.9||^3.0",
+ "laravel/pint": "^1.14",
+ "nunomaduro/collision": "^8.1.1||^7.10.0",
+ "orchestra/testbench": "^10.0.0||^9.0.0||^8.22.0",
+ "pestphp/pest": "^3.0||^2.34",
+ "pestphp/pest-plugin-arch": "^3.0||^2.7",
+ "pestphp/pest-plugin-laravel": "^3.0||^2.3",
+ "phpstan/extension-installer": "^1.3||^2.0",
+ "phpstan/phpstan-deprecation-rules": "^1.1||^2.0",
+ "phpstan/phpstan-phpunit": "^1.3||^2.0",
+ "spatie/laravel-ray": "^1.35"
},
"autoload": {
"psr-4": {
@@ -36,7 +41,8 @@
},
"autoload-dev": {
"psr-4": {
- "Tapp\\Airtable\\Tests\\": "tests"
+ "Tapp\\Airtable\\Tests\\": "tests",
+ "Workbench\\App\\": "workbench/app/"
}
},
"scripts": {
@@ -60,5 +66,7 @@
"Airtable": "Tapp\\Airtable\\Facades\\AirtableFacade"
}
}
- }
+ },
+ "minimum-stability": "dev",
+ "prefer-stable": true
}
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index e69de29..9a695b9 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -0,0 +1,13 @@
+parameters:
+ ignoreErrors:
+ -
+ message: '#^Called ''env'' outside of the config directory which returns null when the config is cached, use ''config''\.$#'
+ identifier: larastan.noEnvCallsOutsideOfConfig
+ count: 5
+ path: config/config.php
+
+ -
+ message: '#^Consider using bind method instead or pass a closure\.$#'
+ identifier: larastan.octaneCompatibility
+ count: 2
+ path: src/AirtableServiceProvider.php
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index 2826a0b..b37ab3c 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -7,6 +7,5 @@ parameters:
- src
- config
tmpDir: build/phpstan
- excludePaths:
- - ./vendor
- checkMissingIterableValueType: true
+ checkOctaneCompatibility: true
+ checkModelProperties: true
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 0000000..7d0904f
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ ./tests
+
+
+
+
+ ./app
+ ./src
+
+
+
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index ae92e16..1ca0817 100755
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,23 +1,38 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- ./tests/Feature
-
-
-
-
- src/
-
-
-
+
+
+
+ tests
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ./src
+
+
+
\ No newline at end of file
diff --git a/src/Airtable.php b/src/Airtable.php
index f241e20..918a12a 100755
--- a/src/Airtable.php
+++ b/src/Airtable.php
@@ -165,7 +165,7 @@ public function updateOrCreate(array $idData, array $updateData = [])
if ($results->isNotEmpty()) {
$item = $results->first();
- //update
+ // update
return $this->update($item['id'], $updateData);
}
diff --git a/tests/Feature/ClientTest.php b/tests/Feature/ClientTest.php
index 7fad28c..3acd3fd 100644
--- a/tests/Feature/ClientTest.php
+++ b/tests/Feature/ClientTest.php
@@ -60,7 +60,7 @@ public function it_can_search()
/** @test */
public function it_can_sort_asc()
{
- //Ascending sort
+ // Ascending sort
$expectedResponseAsc = [
[
'id' => 0,
@@ -90,7 +90,7 @@ public function it_can_sort_asc()
/** @test */
public function it_can_sort_desc()
{
- //Descending sort
+ // Descending sort
$expectedResponseDesc = [
[
'id' => 1,
diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php
new file mode 100644
index 0000000..61cd84c
--- /dev/null
+++ b/tests/Feature/ExampleTest.php
@@ -0,0 +1,5 @@
+toBeTrue();
+});
diff --git a/tests/Pest.php b/tests/Pest.php
new file mode 100644
index 0000000..5949c61
--- /dev/null
+++ b/tests/Pest.php
@@ -0,0 +1,45 @@
+in('Feature');
+
+/*
+|--------------------------------------------------------------------------
+| Expectations
+|--------------------------------------------------------------------------
+|
+| When you're writing tests, you often need to check that values meet certain conditions. The
+| "expect()" function gives you access to a set of "expectations" methods that you can use
+| to assert different things. Of course, you may extend the Expectation API at any time.
+|
+*/
+
+expect()->extend('toBeOne', function () {
+ return $this->toBe(1);
+});
+
+/*
+|--------------------------------------------------------------------------
+| Functions
+|--------------------------------------------------------------------------
+|
+| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
+| project that you don't want to repeat in every file. Here you can also expose helpers as
+| global functions to help you to reduce the number of lines of code in your test files.
+|
+*/
+
+function something()
+{
+ // ..
+}
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 9e78f9b..a007338 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -7,7 +7,7 @@
class TestCase extends \Orchestra\Testbench\TestCase
{
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
// additional setup
diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php
new file mode 100644
index 0000000..61cd84c
--- /dev/null
+++ b/tests/Unit/ExampleTest.php
@@ -0,0 +1,5 @@
+toBeTrue();
+});
diff --git a/tests/autoload.php b/tests/autoload.php
index 8ef6874..593b0b0 100644
--- a/tests/autoload.php
+++ b/tests/autoload.php
@@ -8,5 +8,5 @@
if (! class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
- (new Dotenv())->load(__DIR__.'/../.env');
+ (new Dotenv)->load(__DIR__.'/../.env');
}