Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Pint instead of StyleCI #76

Merged
merged 15 commits into from
Dec 9, 2023
46 changes: 0 additions & 46 deletions .github/run-tests-L7.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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
61 changes: 0 additions & 61 deletions .github/workflows/run-tests-l8.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Run Tests - Current"

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [8.3, 8.2, 8.1, 8.0, 7.4]
laravel: [9.*, 8.*, 10.*]
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
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
testbench: 6.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
coverage: pcov

- 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
- name: Execute tests
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ coverage
.phpunit.result.cache
.DS_Store
.idea
.phpunit.cache
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": "^7.3 || ^8.0",
"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",
"symfony/dotenv": "^4.2 || ^5.1"
Expand All @@ -27,7 +27,7 @@
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.4 || ^9.3.3"
"phpunit/phpunit": "^8.4 || ^9.3.3 || ^10.0"
},
"autoload": {
"psr-4": {
Expand All @@ -43,12 +43,12 @@
"analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"

},
"config": {
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"pestphp/pest-plugin": false
}
},
"extra": {
Expand Down
22 changes: 6 additions & 16 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
Expand All @@ -30,4 +15,9 @@
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
2 changes: 0 additions & 2 deletions src/AirtableManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public function __construct($app)

/**
* Get a airtable table instance.
*
* @param string $table
*/
public function table(string $table)
{
Expand Down
8 changes: 7 additions & 1 deletion src/Api/AirtableApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,22 @@ class AirtableApiClient implements ApiClient
private $client;

private $typecast;

private $base;

private $table;

private $delay;

private $filters = [];

private $fields = [];

private $sorts = [];

private $offset = false;

public function __construct($base, $table, $access_token, Http $client = null, $typecast = false, $delayBetweenRequests = 200000)
public function __construct($base, $table, $access_token, ?Http $client = null, $typecast = false, $delayBetweenRequests = 200000)
{
$this->base = $base;
$this->table = $table;
Expand Down
2 changes: 1 addition & 1 deletion src/Api/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

interface ApiClient
{
public function get(string $id = null);
public function get(?string $id = null);

public function post($contents = null);

Expand Down
20 changes: 10 additions & 10 deletions tests/Feature/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public function it_can_be_instantiated()
public function it_can_post()
{
$expectedResponse = [
'id' => 'randomlygenerated',
'fields' => ['Company Name' => 'Tapp Network'],
'id' => 'randomlygenerated',
'fields' => ['Company Name' => 'Tapp Network'],
'createdTime' => 'timestamp',
];

Expand Down Expand Up @@ -63,13 +63,13 @@ public function it_can_sort_asc()
//Ascending sort
$expectedResponseAsc = [
[
'id' => 0,
'fields' => ['Company Name' => 'A Network'],
'id' => 0,
'fields' => ['Company Name' => 'A Network'],
'createdTime' => 'timestamp',
],
[
'id' => 1,
'fields' => ['Company Name' => 'B Network'],
'id' => 1,
'fields' => ['Company Name' => 'B Network'],
'createdTime' => 'timestamp',
],
];
Expand All @@ -93,13 +93,13 @@ public function it_can_sort_desc()
//Descending sort
$expectedResponseDesc = [
[
'id' => 1,
'fields' => ['Company Name' => 'B Network'],
'id' => 1,
'fields' => ['Company Name' => 'B Network'],
'createdTime' => 'timestamp',
],
[
'id' => 0,
'fields' => ['Company Name' => 'A Network'],
'id' => 0,
'fields' => ['Company Name' => 'A Network'],
'createdTime' => 'timestamp',
],
];
Expand Down
Loading