Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Added support for Laravel 10
Browse files Browse the repository at this point in the history
  • Loading branch information
Combind committed Mar 18, 2023
1 parent dea686d commit f501d84
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 108 deletions.
3 changes: 0 additions & 3 deletions .github/SECURITY.md

This file was deleted.

12 changes: 0 additions & 12 deletions .github/dependabot.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
name: Check & fix styling
name: Fix PHP code style issues

on: [push]
on:
push:
paths:
- '**.php'

jobs:
php-cs-fixer:
php-code-styling:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.dist.php --allow-risky=yes
- name: Fix PHP code style issues
uses: aglipanci/laravel-pint-action@1.0.0

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: none

- name: Install composer dependencies
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1, 8.0]
laravel: [9.*]
stability: [prefer-lowest, prefer-stable]
php: [8.2, 8.1]
laravel: [10.*]
stability: [prefer-stable]
include:
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*
carbon: ^2.63

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -40,7 +41,7 @@ jobs:
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
Expand Down
40 changes: 0 additions & 40 deletions .php-cs-fixer.dist.php

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Laravel Seninblue

[![Latest Version on Packagist](https://img.shields.io/packagist/v/combindma/laravel-sendinblue.svg?style=flat-square)](https://packagist.org/packages/combindma/laravel-sendinblue)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/combindma/laravel-sendinblue/run-tests?label=tests)](https://github.com/combindma/laravel-sendinblue/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/combindma/laravel-sendinblue/Check%20&%20fix%20styling?label=code%20style)](https://github.com/combindma/laravel-sendinblue/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/combindma/laravel-sendinblue/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/combindma/laravel-sendinblue/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/combindma/laravel-sendinblue/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/combindma/laravel-sendinblue/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/combindma/laravel-sendinblue.svg?style=flat-square)](https://packagist.org/packages/combindma/laravel-sendinblue)

Manage newsletters in Laravel with Sendinblue
Expand Down
14 changes: 8 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.1",
"guzzlehttp/guzzle": "^7.4",
"illuminate/contracts": "^9.0",
"illuminate/contracts": "^9.0|^10.0",
"sendinblue/api-v3-sdk": "^8.0",
"spatie/laravel-package-tools": "^1.9.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.4",
"laravel/pint": "^1.0",
"nunomaduro/collision": "^6.0",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^7.0",
"orchestra/testbench": "^7.0|^8.0",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.1",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.6"
},
"autoload": {
"psr-4": {
Expand All @@ -45,10 +45,12 @@
}
},
"scripts": {
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
"analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage",
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes"
"format": "vendor/bin/pint",
"format-v": "vendor/bin/pint -v"
},
"config": {
"sort-packages": true,
Expand Down
2 changes: 1 addition & 1 deletion config/sendinblue.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
*/
'defaultListIds' => [
2,
]
],
];
10 changes: 7 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
verbose="true"
>
<testsuites>
<testsuite name="Combindma Test Suite">
<testsuite name="Laravel Sendinblue Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<!--<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
Expand All @@ -35,5 +35,9 @@
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
</logging>-->
<php>
<env name="APP_KEY" value="base64:2fl+Ktvkfl+Fuz4Qp/A75G2RTiWVA/ZoKZvp6fiiM10="/>
<!-- <env name="XDEBUG_MODE" value="coverage"/>-->
</php>
</phpunit>
3 changes: 3 additions & 0 deletions src/Sendinblue.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
class Sendinblue
{
protected $apiKey;

protected $apiEnabled;

protected $listIds;

protected $baseUri = 'https://api.sendinblue.com/v3';

public function __construct()
Expand Down
5 changes: 0 additions & 5 deletions tests/ExampleTest.php

This file was deleted.

8 changes: 8 additions & 0 deletions tests/SendinblueTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

it('can test if config file are set', function () {
expect($this->sendinblue->getApiKey())->toBe('sendinblue-api-key')
->and($this->sendinblue->getListIds())->toBe([1])
->and($this->sendinblue->getBaseUri())->toBe('https://api.sendinblue.com/v3')
->and($this->sendinblue->apiIsNotEnabled())->toBeFalse();
});
29 changes: 10 additions & 19 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,26 @@

namespace Combindma\Sendinblue\Tests;

use Combindma\Sendinblue\Sendinblue;
use Combindma\Sendinblue\SendinblueServiceProvider;
use Illuminate\Database\Eloquent\Factories\Factory;
use Orchestra\Testbench\TestCase as Orchestra;

class TestCase extends Orchestra
{
protected function setUp(): void
{
parent::setUp();

Factory::guessFactoryNamesUsing(
fn (string $modelName) => 'Combindma\\Sendinblue\\Database\\Factories\\'.class_basename($modelName).'Factory'
);
}
public Sendinblue $sendinblue;

protected function getPackageProviders($app)
protected function getPackageProviders($app): array
{
return [
SendinblueServiceProvider::class,
];
}

public function getEnvironmentSetUp($app)
{
config()->set('database.default', 'testing');

/*
$migration = include __DIR__.'/../database/migrations/create_laravel-sendinblue_table.php.stub';
$migration->up();
*/
}
public function getEnvironmentSetUp($app)
{
$app['config']->set('sendinblue.apiKey', 'sendinblue-api-key');
$app['config']->set('sendinblue.defaultListIds', [1]);
$app['config']->set('sendinblue.api_enabled', true);
$this->sendinblue = new Sendinblue();
}
}

0 comments on commit f501d84

Please sign in to comment.