Skip to content

Commit

Permalink
Laravel 11.x Compatibility (#20)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Dyrynda <[email protected]>
  • Loading branch information
laravel-shift and michaeldyrynda authored Jan 6, 2025
1 parent 044ea53 commit adcc756
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 84 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ name: run-tests
on:
push:
pull_request:
types: [opened, edited]
types:
- opened
- edited

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [8.2,8.1]
laravel: [10.0]
php: [8.4, 8.3, 8.2]
laravel: [11.0]

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

Expand All @@ -21,7 +24,7 @@ jobs:
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
Expand All @@ -44,4 +47,4 @@ jobs:
composer update --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: vendor/bin/phpunit --coverage-clover=coverage.clover
run: vendor/bin/pest
96 changes: 51 additions & 45 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,54 @@
{
"name": "dyrynda/laravel-make-user",
"description": "An Artisan console command to create users in your Laravel application.",
"license": "MIT",
"keywords": [
"laravel",
"artisan",
"console"
],
"authors": [
{
"name": "Michael Dyrynda",
"email": "[email protected]",
"homepage": "https://dyrynda.com.au"
}
],
"require": {
"php": "^8.1",
"illuminate/support": "^10.0",
"illuminate/console": "^10.0",
"illuminate/database": "^10.0",
"illuminate/auth": "^10.0",
"illuminate/notifications": "^10.0"
},
"autoload": {
"psr-4": {
"Dyrynda\\Artisan\\": "src/"
}
},
"require-dev": {
"mockery/mockery": "^1.4.4",
"phpunit/phpunit": "^9.6.0 || ^10.0.7",
"orchestra/testbench": "^8.0"
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"extra": {
"laravel": {
"providers": [
"Dyrynda\\Artisan\\MakeUserServiceProvider"
]
}
"name": "dyrynda/laravel-make-user",
"description": "An Artisan console command to create users in your Laravel application.",
"license": "MIT",
"keywords": [
"laravel",
"artisan",
"console"
],
"authors": [
{
"name": "Michael Dyrynda",
"email": "[email protected]",
"homepage": "https://dyrynda.com.au"
}
],
"require": {
"php": "^8.1",
"illuminate/support": "^10.0 || ^11.0",
"illuminate/console": "^10.0 || ^11.0",
"illuminate/database": "^10.0 || ^11.0",
"illuminate/auth": "^10.0 || ^11.0",
"illuminate/notifications": "^10.0 || ^11.0"
},
"autoload": {
"psr-4": {
"Dyrynda\\Artisan\\": "src/"
}
},
"require-dev": {
"mockery/mockery": "^1.4.4",
"orchestra/testbench": "^8.0 || ^9.0",
"pestphp/pest": "^3.0"
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"laravel": {
"providers": [
"Dyrynda\\Artisan\\MakeUserServiceProvider"
]
}
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
}
12 changes: 6 additions & 6 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<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">
<testsuites>
<testsuite name="Package Test Suite">
<directory>./tests/</directory>
Expand All @@ -13,4 +8,9 @@
<php>
<env name="MAIL_MAILER" value="array"/>
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
47 changes: 19 additions & 28 deletions tests/MakeUserTest.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
<?php

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

class MakeUserTest extends TestCase
{
/** @test */
public function it_creates_a_new_user()
{
$this->artisan('make:user')
->expectsQuestion("What is the new user's email address?", '[email protected]')
->expectsQuestion("What is the new user's name?", 'Test User')
->expectsQuestion("What is the new user's password? (blank generates a random one)", '')
->expectsQuestion('Should the password be encrypted?', 'yes')
->expectsQuestion('Do you want to send a password reset email?', 'no')
->expectsQuestion('Do you have any custom user fields to add? Field=Value (blank continues)', '');
}

/** @test */
public function it_creates_a_new_user_with_additional_fields()
{
$this->artisan('make:user')
->expectsQuestion("What is the new user's email address?", '[email protected]')
->expectsQuestion("What is the new user's name?", 'Test User')
->expectsQuestion("What is the new user's password? (blank generates a random one)", '')
->expectsQuestion('Should the password be encrypted?', 'yes')
->expectsQuestion('Do you want to send a password reset email?', 'no')
->expectsQuestion('Do you have any custom user fields to add? Field=Value (blank continues)', 'field=value')
->expectsQuestion('Do you have any custom user fields to add? Field=Value (blank continues)', '');
}
}
it('creates a new user with additional fields', function () {
$this->artisan('make:user')
->expectsQuestion("What is the new user's email address?", '[email protected]')
->expectsQuestion("What is the new user's name?", 'Test User')
->expectsQuestion("What is the new user's password? (blank generates a random one)", '')
->expectsQuestion('Should the password be encrypted?', 'yes')
->expectsQuestion('Do you want to send a password reset email?', 'no')
->expectsQuestion('Do you have any custom user fields to add? Field=Value (blank continues)', 'field=value')
->expectsQuestion('Do you have any custom user fields to add? Field=Value (blank continues)', '');
});
3 changes: 3 additions & 0 deletions tests/Pest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

uses(Tests\TestCase::class)->in(__DIR__);

0 comments on commit adcc756

Please sign in to comment.