Skip to content

Commit adcc756

Browse files
Laravel 11.x Compatibility (#20)
Co-authored-by: Michael Dyrynda <[email protected]>
1 parent 044ea53 commit adcc756

File tree

5 files changed

+87
-84
lines changed

5 files changed

+87
-84
lines changed

.github/workflows/run-tests.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ name: run-tests
33
on:
44
push:
55
pull_request:
6-
types: [opened, edited]
6+
types:
7+
- opened
8+
- edited
79

810
jobs:
911
test:
1012
runs-on: ubuntu-latest
13+
1114
strategy:
1215
fail-fast: true
1316
matrix:
14-
php: [8.2,8.1]
15-
laravel: [10.0]
17+
php: [8.4, 8.3, 8.2]
18+
laravel: [11.0]
1619

1720
name: P${{ matrix.php }} - L${{ matrix.laravel }}
1821

@@ -21,7 +24,7 @@ jobs:
2124
uses: actions/checkout@v2
2225

2326
- name: Cache dependencies
24-
uses: actions/cache@v1
27+
uses: actions/cache@v2
2528
with:
2629
path: ~/.composer/cache/files
2730
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
@@ -44,4 +47,4 @@ jobs:
4447
composer update --prefer-dist --no-interaction --no-progress
4548
4649
- name: Execute tests
47-
run: vendor/bin/phpunit --coverage-clover=coverage.clover
50+
run: vendor/bin/pest

composer.json

+51-45
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,54 @@
11
{
2-
"name": "dyrynda/laravel-make-user",
3-
"description": "An Artisan console command to create users in your Laravel application.",
4-
"license": "MIT",
5-
"keywords": [
6-
"laravel",
7-
"artisan",
8-
"console"
9-
],
10-
"authors": [
11-
{
12-
"name": "Michael Dyrynda",
13-
"email": "[email protected]",
14-
"homepage": "https://dyrynda.com.au"
15-
}
16-
],
17-
"require": {
18-
"php": "^8.1",
19-
"illuminate/support": "^10.0",
20-
"illuminate/console": "^10.0",
21-
"illuminate/database": "^10.0",
22-
"illuminate/auth": "^10.0",
23-
"illuminate/notifications": "^10.0"
24-
},
25-
"autoload": {
26-
"psr-4": {
27-
"Dyrynda\\Artisan\\": "src/"
28-
}
29-
},
30-
"require-dev": {
31-
"mockery/mockery": "^1.4.4",
32-
"phpunit/phpunit": "^9.6.0 || ^10.0.7",
33-
"orchestra/testbench": "^8.0"
34-
},
35-
"autoload-dev": {
36-
"psr-4": {
37-
"Tests\\": "tests/"
38-
}
39-
},
40-
"minimum-stability": "dev",
41-
"extra": {
42-
"laravel": {
43-
"providers": [
44-
"Dyrynda\\Artisan\\MakeUserServiceProvider"
45-
]
46-
}
2+
"name": "dyrynda/laravel-make-user",
3+
"description": "An Artisan console command to create users in your Laravel application.",
4+
"license": "MIT",
5+
"keywords": [
6+
"laravel",
7+
"artisan",
8+
"console"
9+
],
10+
"authors": [
11+
{
12+
"name": "Michael Dyrynda",
13+
"email": "[email protected]",
14+
"homepage": "https://dyrynda.com.au"
4715
}
16+
],
17+
"require": {
18+
"php": "^8.1",
19+
"illuminate/support": "^10.0 || ^11.0",
20+
"illuminate/console": "^10.0 || ^11.0",
21+
"illuminate/database": "^10.0 || ^11.0",
22+
"illuminate/auth": "^10.0 || ^11.0",
23+
"illuminate/notifications": "^10.0 || ^11.0"
24+
},
25+
"autoload": {
26+
"psr-4": {
27+
"Dyrynda\\Artisan\\": "src/"
28+
}
29+
},
30+
"require-dev": {
31+
"mockery/mockery": "^1.4.4",
32+
"orchestra/testbench": "^8.0 || ^9.0",
33+
"pestphp/pest": "^3.0"
34+
},
35+
"autoload-dev": {
36+
"psr-4": {
37+
"Tests\\": "tests/"
38+
}
39+
},
40+
"minimum-stability": "dev",
41+
"prefer-stable": true,
42+
"extra": {
43+
"laravel": {
44+
"providers": [
45+
"Dyrynda\\Artisan\\MakeUserServiceProvider"
46+
]
47+
}
48+
},
49+
"config": {
50+
"allow-plugins": {
51+
"pestphp/pest-plugin": true
52+
}
53+
}
4854
}

phpunit.xml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<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.1/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3-
<coverage>
4-
<include>
5-
<directory suffix=".php">src/</directory>
6-
</include>
7-
</coverage>
2+
<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" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
83
<testsuites>
94
<testsuite name="Package Test Suite">
105
<directory>./tests/</directory>
@@ -13,4 +8,9 @@
138
<php>
149
<env name="MAIL_MAILER" value="array"/>
1510
</php>
11+
<source>
12+
<include>
13+
<directory suffix=".php">src/</directory>
14+
</include>
15+
</source>
1616
</phpunit>

tests/MakeUserTest.php

+19-28
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
<?php
22

3-
namespace Tests;
3+
it('creates a new user', function () {
4+
$this->artisan('make:user')
5+
->expectsQuestion("What is the new user's email address?", '[email protected]')
6+
->expectsQuestion("What is the new user's name?", 'Test User')
7+
->expectsQuestion("What is the new user's password? (blank generates a random one)", '')
8+
->expectsQuestion('Should the password be encrypted?', 'yes')
9+
->expectsQuestion('Do you want to send a password reset email?', 'no')
10+
->expectsQuestion('Do you have any custom user fields to add? Field=Value (blank continues)', '');
11+
});
412

5-
class MakeUserTest extends TestCase
6-
{
7-
/** @test */
8-
public function it_creates_a_new_user()
9-
{
10-
$this->artisan('make:user')
11-
->expectsQuestion("What is the new user's email address?", '[email protected]')
12-
->expectsQuestion("What is the new user's name?", 'Test User')
13-
->expectsQuestion("What is the new user's password? (blank generates a random one)", '')
14-
->expectsQuestion('Should the password be encrypted?', 'yes')
15-
->expectsQuestion('Do you want to send a password reset email?', 'no')
16-
->expectsQuestion('Do you have any custom user fields to add? Field=Value (blank continues)', '');
17-
}
18-
19-
/** @test */
20-
public function it_creates_a_new_user_with_additional_fields()
21-
{
22-
$this->artisan('make:user')
23-
->expectsQuestion("What is the new user's email address?", '[email protected]')
24-
->expectsQuestion("What is the new user's name?", 'Test User')
25-
->expectsQuestion("What is the new user's password? (blank generates a random one)", '')
26-
->expectsQuestion('Should the password be encrypted?', 'yes')
27-
->expectsQuestion('Do you want to send a password reset email?', 'no')
28-
->expectsQuestion('Do you have any custom user fields to add? Field=Value (blank continues)', 'field=value')
29-
->expectsQuestion('Do you have any custom user fields to add? Field=Value (blank continues)', '');
30-
}
31-
}
13+
it('creates a new user with additional fields', function () {
14+
$this->artisan('make:user')
15+
->expectsQuestion("What is the new user's email address?", '[email protected]')
16+
->expectsQuestion("What is the new user's name?", 'Test User')
17+
->expectsQuestion("What is the new user's password? (blank generates a random one)", '')
18+
->expectsQuestion('Should the password be encrypted?', 'yes')
19+
->expectsQuestion('Do you want to send a password reset email?', 'no')
20+
->expectsQuestion('Do you have any custom user fields to add? Field=Value (blank continues)', 'field=value')
21+
->expectsQuestion('Do you have any custom user fields to add? Field=Value (blank continues)', '');
22+
});

tests/Pest.php

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
uses(Tests\TestCase::class)->in(__DIR__);

0 commit comments

Comments
 (0)