Skip to content

Commit

Permalink
Merge pull request #36 from ARCANEDEV/update-laravel_8_support
Browse files Browse the repository at this point in the history
Adding Laravel 8.x Support
  • Loading branch information
arcanedev-maroc authored Oct 24, 2020
2 parents fa30810 + 5bc4c6f commit 8c56497
Show file tree
Hide file tree
Showing 14 changed files with 220 additions and 82 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4]
php: [7.3, 7.4]
dependency-version: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}
Expand All @@ -22,7 +22,7 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-7.x-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
key: dependencies-laravel-8.x-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 6
runs: 4
php_code_sniffer:
enabled: true
config:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This Laravel Notes will allow you to add a notes system into your Laravel projec
* Easy setup & configuration.
* Well documented & IDE Friendly.
* Well tested with maximum code quality.
* Laravel `5.1` to `7.x` are supported.
* Laravel `5.1` to `8.x` are supported.
* Made with :heart: & :coffee:.

## Table of contents
Expand All @@ -42,7 +42,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.
- [ARCANEDEV][link-author]
- [All Contributors][link-contributors]

[badge_laravel]: https://img.shields.io/badge/For%20Laravel-5.1%20to%207.x-orange.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/For%20Laravel-5.1%20to%208.x-orange.svg?style=flat-square
[badge_license]: https://img.shields.io/packagist/l/arcanedev/laravel-notes.svg?style=flat-square
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/LaravelNotes/run-tests?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/LaravelNotes.svg?style=flat-square
Expand Down
2 changes: 1 addition & 1 deletion _docs/0-Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This Laravel Notes will allow you to add a notes system into your Laravel projec
* Easy setup & configuration.
* Well documented & IDE Friendly.
* Well tested with maximum code quality.
* Laravel `5.1` to `7.x` are supported.
* Laravel `5.1` to `8.x` are supported.
* Made with :heart: & :coffee:.

## Table of contents
Expand Down
3 changes: 3 additions & 0 deletions _docs/1-Installation-and-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

| Laravel | Laravel Notes |
|:-----------------------------|:-----------------------------------------|
| ![Laravel v8.x][laravel_8_x] | ![Laravel Notes v8.x][laravel_notes_8_x] |
| ![Laravel v7.x][laravel_7_x] | ![Laravel Notes v7.x][laravel_notes_7_x] |
| ![Laravel v6.x][laravel_6_x] | ![Laravel Notes v6.x][laravel_notes_6_x] |
| ![Laravel v5.8][laravel_5_8] | ![Laravel Notes v5.x][laravel_notes_5_x] |
Expand All @@ -21,6 +22,7 @@
| ![Laravel v5.2][laravel_5_2] | ![Laravel Notes v0.x][laravel_notes_0_x] |
| ![Laravel v5.1][laravel_5_1] | ![Laravel Notes v0.x][laravel_notes_0_x] |

[laravel_8_x]: https://img.shields.io/badge/version-8.x-blue.svg?style=flat-square "Laravel v8.x"
[laravel_7_x]: https://img.shields.io/badge/version-7.x-blue.svg?style=flat-square "Laravel v7.x"
[laravel_6_x]: https://img.shields.io/badge/version-6.x-blue.svg?style=flat-square "Laravel v6.x"
[laravel_5_8]: https://img.shields.io/badge/version-5.8-blue.svg?style=flat-square "Laravel v5.8"
Expand All @@ -32,6 +34,7 @@
[laravel_5_2]: https://img.shields.io/badge/version-5.2-blue.svg?style=flat-square "Laravel v5.2"
[laravel_5_1]: https://img.shields.io/badge/version-5.1-blue.svg?style=flat-square "Laravel v5.1"

[laravel_notes_8_x]: https://img.shields.io/badge/version-8.x-blue.svg?style=flat-square "LaravelNotes v8.x"
[laravel_notes_7_x]: https://img.shields.io/badge/version-7.x-blue.svg?style=flat-square "LaravelNotes v7.x"
[laravel_notes_6_x]: https://img.shields.io/badge/version-6.x-blue.svg?style=flat-square "LaravelNotes v6.x"
[laravel_notes_5_x]: https://img.shields.io/badge/version-5.x-blue.svg?style=flat-square "LaravelNotes v5.x"
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"type": "library",
"license": "MIT",
"require": {
"php": "^7.2.5",
"arcanedev/support": "^7.0"
"php": "^7.3",
"arcanedev/support": "^8.0"
},
"require-dev": {
"mockery/mockery": "^1.3.1",
"orchestra/testbench": "^5.0",
"phpunit/phpunit": "^8.5|^9.0"
"orchestra/testbench": "^6.0",
"phpunit/phpunit": "^9.3"
},
"autoload": {
"psr-4": {
Expand Down
35 changes: 15 additions & 20 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
<exclude>./tests/fixtures/</exclude>
<directory suffix=".php">./tests</directory>
<exclude>./tests/fixtures</exclude>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<clover outputFile="build/coverage/clover.xml"/>
<html outputDirectory="build/coverage/html"/>
<text outputFile="build/coverage/coverage.txt" showOnlySummary="true"/>
</report>
</coverage>
<php>
<env name="DB_CONNECTION" value="testing"/>
</php>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-text" target="build/logs/coverage.txt"/>
<log type="coverage-html" target="build/logs/coverage"/>
</logging>
</phpunit>
15 changes: 8 additions & 7 deletions tests/Models/NoteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
namespace Arcanedev\LaravelNotes\Tests\Models;

use Arcanedev\LaravelNotes\Models\Note;
use Arcanedev\LaravelNotes\Tests\Stubs\Models\{Post, User, UserWithAuthorId};
use Arcanedev\LaravelNotes\Tests\Stubs\Factories\{PostFactory, UserFactory, UserWithAuthorIdFactory};
use Arcanedev\LaravelNotes\Tests\Stubs\Models\User;
use Arcanedev\LaravelNotes\Tests\TestCase;

/**
Expand Down Expand Up @@ -205,28 +206,28 @@ public function it_must_retrieve_authored_notes_foreach_owner(): void
*
* @return \Arcanedev\LaravelNotes\Tests\Stubs\Models\Post|mixed
*/
protected function createPost()
protected static function createPost()
{
return factory(Post::class)->create();
return PostFactory::new()->create();
}

/**
* Create a user.
*
* @return \Arcanedev\LaravelNotes\Tests\Stubs\Models\User|mixed
*/
protected function createUser()
protected static function createUser()
{
return factory(User::class)->create();
return UserFactory::new()->create();
}

/**
* Create a user with author id associated.
*
* @return \Arcanedev\LaravelNotes\Tests\Stubs\Models\UserWithAuthorId|mixed
*/
protected function createUserWithAuthorId()
protected static function createUserWithAuthorId()
{
return factory(UserWithAuthorId::class)->create();
return UserWithAuthorIdFactory::new()->create();
}
}
45 changes: 45 additions & 0 deletions tests/Stubs/Factories/NoteFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelNotes\Tests\Stubs\Factories;

use Arcanedev\LaravelNotes\Tests\Stubs\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
* Class NoteFactory
*
* @author ARCANEDEV <[email protected]>
*/
class NoteFactory extends Factory
{
/* -----------------------------------------------------------------
| Properties
| -----------------------------------------------------------------
*/

/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;

/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
*/

/**
* Define the model's default state.
*
* @return array
*/
public function definition(): array
{
return [
'content' => $this->faker->paragraph,
];
}
}
46 changes: 46 additions & 0 deletions tests/Stubs/Factories/PostFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelNotes\Tests\Stubs\Factories;

use Arcanedev\LaravelNotes\Tests\Stubs\Models\Post;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
* Class PostFactory
*
* @author ARCANEDEV <[email protected]>
*/
class PostFactory extends Factory
{
/* -----------------------------------------------------------------
| Properties
| -----------------------------------------------------------------
*/

/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Post::class;

/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
*/

/**
* Define the model's default state.
*
* @return array
*/
public function definition(): array
{
return [
'title' => $this->faker->paragraph,
'content' => $this->faker->paragraphs(5, true),
];
}
}
46 changes: 46 additions & 0 deletions tests/Stubs/Factories/UserFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelNotes\Tests\Stubs\Factories;

use Arcanedev\LaravelNotes\Tests\Stubs\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
* Class UserFactory
*
* @author ARCANEDEV <[email protected]>
*/
class UserFactory extends Factory
{
/* -----------------------------------------------------------------
| Properties
| -----------------------------------------------------------------
*/

/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;

/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
*/

/**
* Define the model's default state.
*
* @return array
*/
public function definition(): array
{
return [
'name' => $this->faker->name,
'email' => $this->faker->safeEmail,
];
}
}
46 changes: 46 additions & 0 deletions tests/Stubs/Factories/UserWithAuthorIdFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelNotes\Tests\Stubs\Factories;

use Arcanedev\LaravelNotes\Tests\Stubs\Models\UserWithAuthorId;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
* Class UserWithAuthorIdFactory
*
* @author ARCANEDEV <[email protected]>
*/
class UserWithAuthorIdFactory extends Factory
{
/* -----------------------------------------------------------------
| Properties
| -----------------------------------------------------------------
*/

/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = UserWithAuthorId::class;

/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
*/

/**
* Define the model's default state.
*
* @return array
*/
public function definition(): array
{
return [
'name' => $this->faker->name,
'email' => $this->faker->safeEmail,
];
}
}
11 changes: 1 addition & 10 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@
*/
abstract class TestCase extends BaseTestCase
{
/* -----------------------------------------------------------------
| Properties
| -----------------------------------------------------------------
*/

/** @var \Illuminate\Database\Eloquent\Factory */
protected $factory;

/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
Expand All @@ -31,8 +23,7 @@ public function setUp(): void
{
parent::setUp();

$this->migrate();
$this->withFactories(__DIR__.'/fixtures/factories');
$this->migrate();;
}

/**
Expand Down
Loading

0 comments on commit 8c56497

Please sign in to comment.