Skip to content

Commit

Permalink
Update tests & add github workflow to run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emincanozcan committed Dec 12, 2021
1 parent eaa3a3f commit 5c360bb
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: run-tests

on: [push, pull_request]

jobs:
test:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ["8.1", "8.0"]
laravel: ["^8.0"]
dependency-version: [prefer-lowest, prefer-stable]

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

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

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --dev --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions database/factories/UserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function definition()
{
return [
'name' => $this->faker->name(),
'username' => $this->faker->userName(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
Expand Down
1 change: 1 addition & 0 deletions tests/Feature/RegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function test_new_users_can_register()

$response = $this->post('/register', [
'name' => 'Test User',
'username' => 'iComposeArtLikeTheGhostOfMozart',
'email' => '[email protected]',
'password' => 'password',
'password_confirmation' => 'password',
Expand Down

0 comments on commit 5c360bb

Please sign in to comment.