mirror of
https://github.com/michaelachrisco/ReadOnlyTraitLaravel.git
synced 2024-12-26 07:37:20 -08:00
Merge pull request #57 from michaelachrisco/56-add-context-to-kahlan
feat(spec): Testing users should have more context
This commit is contained in:
commit
276836059b
2 changed files with 179 additions and 164 deletions
|
@ -19,9 +19,19 @@ jobs:
|
||||||
- run: sudo composer self-update
|
- run: sudo composer self-update
|
||||||
- run: composer install -n --prefer-dist --no-plugins
|
- run: composer install -n --prefer-dist --no-plugins
|
||||||
- run: ./vendor/bin/kahlan -reporter=verbose
|
- run: ./vendor/bin/kahlan -reporter=verbose
|
||||||
|
build_php_version_83:
|
||||||
|
docker:
|
||||||
|
- image: cimg/php:8.3.0
|
||||||
|
working_directory: ~/ReadOnlyTraitLaravel
|
||||||
|
steps: # a set of executable commands
|
||||||
|
- checkout
|
||||||
|
- run: sudo composer self-update
|
||||||
|
- run: composer install -n --prefer-dist --no-plugins
|
||||||
|
- run: ./vendor/bin/kahlan -reporter=verbose
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build:
|
build:
|
||||||
jobs:
|
jobs:
|
||||||
- build_php_version_81
|
- build_php_version_81
|
||||||
- build_php_version_82
|
- build_php_version_82
|
||||||
|
- build_php_version_83
|
||||||
|
|
|
@ -4,11 +4,13 @@ require_once('src/ReadOnlyTrait.php');
|
||||||
use MichaelAChrisco\ReadOnly\ReadOnlyException;
|
use MichaelAChrisco\ReadOnly\ReadOnlyException;
|
||||||
use MichaelAChrisco\ReadOnly\ReadOnlyTrait;
|
use MichaelAChrisco\ReadOnly\ReadOnlyTrait;
|
||||||
|
|
||||||
class User extends Illuminate\Database\Eloquent\Model {
|
class User extends Illuminate\Database\Eloquent\Model
|
||||||
|
{
|
||||||
use ReadOnlyTrait;
|
use ReadOnlyTrait;
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("User", function () {
|
describe("User", function () {
|
||||||
|
context("When User calls unsupported method", function () {
|
||||||
describe("::create()", function () {
|
describe("::create()", function () {
|
||||||
it("is expected to throw ReadOnlyException", function () {
|
it("is expected to throw ReadOnlyException", function () {
|
||||||
expect(
|
expect(
|
||||||
|
@ -163,6 +165,7 @@ describe("User", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
class MockModel
|
class MockModel
|
||||||
{
|
{
|
||||||
|
@ -183,6 +186,7 @@ class UserReadOnlyNotActive extends MockModel
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("UserReadOnlyNotActive", function () {
|
describe("UserReadOnlyNotActive", function () {
|
||||||
|
context("When UserReadOnlyNotActive calls unsupported method and isActive is true", function () {
|
||||||
describe("::create()", function () {
|
describe("::create()", function () {
|
||||||
it("expects `create()` to be toBeTruthy", function () {
|
it("expects `create()` to be toBeTruthy", function () {
|
||||||
$user = new UserReadOnlyNotActive;
|
$user = new UserReadOnlyNotActive;
|
||||||
|
@ -190,3 +194,4 @@ describe("UserReadOnlyNotActive", function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue