Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
phpunit.xml.dist export-ignore
/.gitattributes export-ignore
/.github/ export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: test

on:
push:
pull_request:

jobs:
linux_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
stability: [prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }}

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: xdebug

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: php vendor/bin/phpunit
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
],
"require": {
"php": ">=7.2",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0"
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.0",
"orchestra/testbench": "^5.0|^6.0",
"doctrine/dbal": "^2.9"
"phpunit/phpunit": "^8.0|^9.0|^10.0|^11.0|^12.0",
"orchestra/testbench": "^5.0|^6.0|^7.0|^8.0|^9.0|^10.0",
"doctrine/dbal": "^2.9|^3.0|^4.0"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 2 additions & 3 deletions tests/MigrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

use Illuminate\Support\Facades\Schema;

class MigrationsTest extends TestCase
class MigrationTest extends TestCase
{
/* ------------------------------------------------------------------------------------------------
| Test Functions
| ------------------------------------------------------------------------------------------------
*/

/** @test */
public function itCanMigrate()
public function testItCanMigrate()
{
$this->migrate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Kodeine\Acl\Tests\TestCase;

abstract class ModelsTest extends TestCase
abstract class ModelsTestCase extends TestCase
{
/* ------------------------------------------------------------------------------------------------
| Main Functions
Expand Down
17 changes: 6 additions & 11 deletions tests/Models/PermissionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Kodeine\Acl\Models\Eloquent\Role;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class PermissionTest extends ModelsTest
class PermissionTest extends ModelsTestCase
{
/* ------------------------------------------------------------------------------------------------
| Properties
Expand Down Expand Up @@ -37,8 +37,7 @@ public function tearDown(): void
| Test Functions
| ------------------------------------------------------------------------------------------------
*/
/** @test */
public function itCanBeInstantiated()
public function testItCanBeInstantiated()
{
$expectations = [
\Illuminate\Database\Eloquent\Model::class,
Expand All @@ -50,8 +49,7 @@ public function itCanBeInstantiated()
}
}

/** @test */
public function itHasRelationships()
public function testItHasRelationships()
{
$rolesRelationship = $this->permissionModel->roles();

Expand All @@ -63,8 +61,7 @@ public function itHasRelationships()
);
}

/** @test */
public function itCanCreate()
public function testItCanCreate()
{
$attributes = [
'name' => 'Create users',
Expand All @@ -84,8 +81,7 @@ public function itCanCreate()
]);
}

/** @test */
public function itCanUpdate()
public function testItCanUpdate()
{
$attributes = [
'name' => 'Create users',
Expand Down Expand Up @@ -114,8 +110,7 @@ public function itCanUpdate()
$this->assertDatabaseMissing('permissions', $attributes);
}

/** @test */
public function itCanDelete()
public function testItCanDelete()
{
$attributes = [
'name' => 'Create users',
Expand Down
23 changes: 9 additions & 14 deletions tests/Models/RoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Kodeine\Acl\Models\Eloquent\User;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class RoleTest extends ModelsTest
class RoleTest extends ModelsTestCase
{
/* ------------------------------------------------------------------------------------------------
| Properties
Expand Down Expand Up @@ -36,8 +36,7 @@ public function tearDown(): void
| Test Functions
| ------------------------------------------------------------------------------------------------
*/
/** @test */
public function itCanBeInstantiated()
public function testItCanBeInstantiated()
{
$expectations = [
\Illuminate\Database\Eloquent\Model::class,
Expand All @@ -49,8 +48,7 @@ public function itCanBeInstantiated()
}
}

/** @test */
public function itHasRelationships()
public function testItHasRelationships()
{
$usersRelationship = $this->roleModel->users();
$permissionsRelationship = $this->roleModel->permissions();
Expand All @@ -68,9 +66,8 @@ public function itHasRelationships()
$this->assertInstanceOf(User::class, $user);
$this->assertInstanceOf(Permission::class, $permission);
}

/** @test */
public function itCanCreate()

public function testItCanCreate()
{
$attributes = [
'name' => 'Custom role',
Expand All @@ -86,9 +83,8 @@ public function itCanCreate()

$this->assertDatabaseHas('roles', $attributes);
}

/** @test */
public function itCanUpdate()

public function testItCanUpdate()
{
$attributes = $this->getAdminRoleAttributes();

Expand All @@ -108,9 +104,8 @@ public function itCanUpdate()
$this->assertDatabaseHas('roles', $updatedAttributes);
$this->assertDatabaseHas('roles', $role->toArray());
}

/** @test */
public function itCanDelete()

public function testItCanDelete()
{
$role = $this->createRole();

Expand Down
14 changes: 5 additions & 9 deletions tests/Models/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Kodeine\Acl\Models\Eloquent\User;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class UserTest extends ModelsTest
class UserTest extends ModelsTestCase
{
/* ------------------------------------------------------------------------------------------------
| Properties
Expand Down Expand Up @@ -36,8 +36,7 @@ public function tearDown(): void
| Test Functions
| ------------------------------------------------------------------------------------------------
*/
/** @test */
public function itCanBeInstantiated()
public function testItCanBeInstantiated()
{
$expectations = [
\Illuminate\Database\Eloquent\Model::class,
Expand All @@ -49,8 +48,7 @@ public function itCanBeInstantiated()
}
}

/** @test */
public function itCanAttachRole()
public function testItCanAttachRole()
{
$objRole = new Role();
$role = $objRole->create([
Expand All @@ -70,8 +68,7 @@ public function itCanAttachRole()
$this->assertEquals($user->getRoles(), [ 1 => $this->str_slug('Admin role', config('laravel-auth.slug-separator'))]);
}

/** @test */
public function itCanAttachRoleAndPermission()
public function testItCanAttachRoleAndPermission()
{
$objRole = new Role();
$roleAttributes = [
Expand Down Expand Up @@ -107,8 +104,7 @@ public function itCanAttachRoleAndPermission()
$this->assertEquals($user->getPermissions(), ['post' => $permissionAttributes['slug']]);
}

/** @test */
public function cacheTest()
public function testCache()
{
$objRole = new Role();
$roleAttributes = [
Expand Down