Skip to content

Commit

Permalink
Merge pull request #3 from rokka-io/laravel-11
Browse files Browse the repository at this point in the history
Laravel 11 support + tests
  • Loading branch information
Seeow authored Aug 22, 2024
2 parents fd02429 + 480e90f commit 6598de7
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 25 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: run-tests

on:
push:
branches:
- master
pull_request:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 8.1, 8.2, 8.3 ]
laravel: [ ^10.0, ^11.0 ]
stability: [ prefer-stable ]
include:
- laravel: ^10.0
testbench: ^8.0
- laravel: ^11.0
testbench: ^9.0
exclude:
- laravel: ^11.0
php: 8.1

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
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 }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vendor
/composer.lock
/composer.lock
.phpunit.result.cache
7 changes: 7 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Version 0.6.0
- Added support for Laravel 11
- Added tests
- Updated Rokka client to version 1.21
- Updated minimum required PHP version to 8.1
- Removed compatibility with end-of-life Laravel versions (5, 6, 7, 8, 9)

## Version 0.5.3
- Added Laravel 10.0 compatibility

Expand Down
23 changes: 19 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@
}
],
"homepage": "https://github.com/rokka-io/rokka-laravel",
"keywords": ["Laravel", "Rokka", "image", "resizing"],
"keywords": [
"Laravel",
"Rokka",
"image",
"resizing"
],
"require": {
"php": "^8.0",
"illuminate/support": "^5|^6|^7|^8|^9|^10",
"php": "^8.1",
"rokka/client": "^1.20",
"rokka/client-cli": "^1.9.10"
"rokka/client-cli": "^1.9.10",
"illuminate/support": "^10.0|^11.0"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"orchestra/testbench": "^8.0|^9.0",
"phpunit/phpunit": "^10.5"
},
"autoload": {
"files": [
Expand All @@ -25,6 +35,11 @@
"Rokka\\RokkaLaravel\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Rokka\\RokkaLaravel\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
Expand Down
36 changes: 16 additions & 20 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Package">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src/</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" backupStaticProperties="false">
<testsuites>
<testsuite name="Rokka Laravel Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="ROKKA_ORG" value="testOrg" />
<env name="ROKKA_KEY" value="testKey" />
<env name="PUBLIC_ROKKA_DOMAIN" value="testPublicRokkaDomain" />
</php>
<source>
<include>
<directory>./src</directory>
</include>
</source>
</phpunit>
30 changes: 30 additions & 0 deletions tests/RokkaFacadeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Rokka\RokkaLaravel\Tests;

use Rokka\Client\Image;
use Rokka\Client\User;
use Rokka\RokkaLaravel\Facades\Rokka;

class RokkaFacadeTest extends TestCase
{
public function testOrganization()
{
$this->assertEquals(config('rokka.organisation_name'), Rokka::getOrganization());
}

public function testPublicDomain()
{
$this->assertEquals(config('rokka.public_rokka_domain'), Rokka::getPublicRokkaDomain());
}

public function testImagesClient()
{
$this->assertInstanceOf(Image::class, Rokka::images());
}

public function testUserManagementClient()
{
$this->assertInstanceOf(User::class, Rokka::manage());
}
}
15 changes: 15 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Rokka\RokkaLaravel\Tests;

use Rokka\RokkaLaravel\RokkaLaravelServiceProvider;

class TestCase extends \Orchestra\Testbench\TestCase
{
protected function getPackageProviders($app): array
{
return [
RokkaLaravelServiceProvider::class,
];
}
}

0 comments on commit 6598de7

Please sign in to comment.