Skip to content

Commit

Permalink
Add phpunit test workflow (#973)
Browse files Browse the repository at this point in the history
* Update db address

* Apply fixes from StyleCI

* Fix database env name

* Add .env.action

* Fix db reference

* Update test

* Update test

* Remove travis

* Update barnch ref
  • Loading branch information
Hasnayeen committed Apr 17, 2020
1 parent 560bc48 commit a3be265
Show file tree
Hide file tree
Showing 32 changed files with 122 additions and 131 deletions.
30 changes: 27 additions & 3 deletions .env.travis → .env.action
Expand Up @@ -11,8 +11,8 @@ DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=goodwork
DB_USERNAME=root
DB_PASSWORD=
DB_ROOT_PASSWORD=secret
DB_PASSWORD=password
DB_ROOT_PASSWORD=password

BROADCAST_DRIVER=redis
CACHE_DRIVER=file
Expand All @@ -23,6 +23,7 @@ REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
Expand All @@ -35,4 +36,27 @@ PUSHER_KEY=
PUSHER_SECRET=

# Set it to false for local development
TRAVIS=true
TRAVIS=false

SSL_CERT_DOMAIN=
SSL_CERT_DIR=

MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=

COMPANY_NAME=

TELESCOPE_ENABLED=false

NOTIFICATION_CHANNELS="mail,database"

# mobile login
CLIENT_ID=
CLIENT_SECRET=

# Dropbox setup

DROPBOX_APP_NAME=
DROPBOX_ACCESS_TOKEN=
DROPBOX_KEY=
DROPBOX_SECRET=
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Expand Up @@ -12,15 +12,15 @@ jobs:
php-tests:
runs-on: ubuntu-latest
env:
DB_DATABASE: laravel
DB_DATABASE: goodwork
DB_USERNAME: root
DB_PASSWORD: password
BROADCAST_DRIVER: redis
CACHE_DRIVER: file
QUEUE_DRIVER: redis
SESSION_DRIVER: file
services:
mysql:
db:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:

- name: Prepare the application
run: |
php -r "file_exists('.env') || copy('.env.example', '.env');"
php -r "file_exists('.env') || copy('.env.action', '.env');"
php artisan key:generate
- name: Clear Config
Expand All @@ -69,19 +69,19 @@ jobs:
- name: Run Migration
run: php artisan migrate -v
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
DB_PORT: ${{ job.services.db.ports['3306'] }}

- name: Run Passport
run: |
php artisan passport:install
php artisan passport:keys
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
DB_PORT: ${{ job.services.db.ports['3306'] }}

- name: Test with phpunit
run: vendor/bin/phpunit --coverage-clover=clover.xml
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
DB_PORT: ${{ job.services.db.ports['3306'] }}

- name: Coverage Report
run: bash <(curl -s https://codecov.io/bash)
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions app/Base/Console/Commands/ChannelMakeCommand.php
Expand Up @@ -30,7 +30,7 @@ class ChannelMakeCommand extends GeneratorCommand
/**
* Build the class with the given name.
*
* @param string $name
* @param string $name
* @return string
*/
protected function buildClass($name)
Expand All @@ -55,7 +55,7 @@ protected function getStub()
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
Expand Down
8 changes: 4 additions & 4 deletions app/Base/Console/Commands/ComponentMakeCommand.php
Expand Up @@ -2,9 +2,9 @@

namespace App\Base\Console\Commands;

use Illuminate\Console\GeneratorCommand;
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Str;
use Illuminate\Foundation\Inspiring;
use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Input\InputOption;

class ComponentMakeCommand extends GeneratorCommand
Expand Down Expand Up @@ -74,7 +74,7 @@ protected function writeView()
/**
* Build the class with the given name.
*
* @param string $name
* @param string $name
* @return string
*/
protected function buildClass($name)
Expand Down Expand Up @@ -121,7 +121,7 @@ protected function getStub()
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
Expand Down
8 changes: 4 additions & 4 deletions app/Base/Console/Commands/ConsoleMakeCommand.php
Expand Up @@ -3,8 +3,8 @@
namespace App\Base\Console\Commands;

use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;

class ConsoleMakeCommand extends GeneratorCommand
{
Expand Down Expand Up @@ -34,8 +34,8 @@ class ConsoleMakeCommand extends GeneratorCommand
/**
* Replace the class name for the given stub.
*
* @param string $stub
* @param string $name
* @param string $stub
* @param string $name
* @return string
*/
protected function replaceClass($stub, $name)
Expand All @@ -62,7 +62,7 @@ protected function getStub()
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
Expand Down
6 changes: 3 additions & 3 deletions app/Base/Console/Commands/EventGenerateCommand.php
Expand Up @@ -2,9 +2,9 @@

namespace App\Base\Console\Commands;

use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Illuminate\Foundation\Support\Providers\EventServiceProvider;
use Illuminate\Support\Str;

class EventGenerateCommand extends Command
{
Expand Down Expand Up @@ -43,7 +43,7 @@ public function handle()
/**
* Make the event and listeners for the given event.
*
* @param string $event
* @param string $event
* @param array $listeners
* @return void
*/
Expand All @@ -61,7 +61,7 @@ protected function makeEventAndListeners($event, $listeners)
/**
* Make the listeners for the given event.
*
* @param string $event
* @param string $event
* @param array $listeners
* @return void
*/
Expand Down
4 changes: 2 additions & 2 deletions app/Base/Console/Commands/EventMakeCommand.php
Expand Up @@ -32,7 +32,7 @@ class EventMakeCommand extends GeneratorCommand
/**
* Determine if the class already exists.
*
* @param string $rawName
* @param string $rawName
* @return bool
*/
protected function alreadyExists($rawName)
Expand All @@ -53,7 +53,7 @@ protected function getStub()
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
Expand Down
4 changes: 2 additions & 2 deletions app/Base/Console/Commands/ExceptionMakeCommand.php
Expand Up @@ -51,7 +51,7 @@ protected function getStub()
/**
* Determine if the class already exists.
*
* @param string $rawName
* @param string $rawName
* @return bool
*/
protected function alreadyExists($rawName)
Expand All @@ -62,7 +62,7 @@ protected function alreadyExists($rawName)
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
Expand Down
4 changes: 2 additions & 2 deletions app/Base/Console/Commands/GetRootNamespace.php
Expand Up @@ -23,7 +23,7 @@ protected function rootNamespace()
/**
* Get the destination class path.
*
* @param string $name
* @param string $name
* @return string
*/
protected function getPath($name)
Expand All @@ -32,4 +32,4 @@ protected function getPath($name)

return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php';
}
}
}
4 changes: 2 additions & 2 deletions app/Base/Console/Commands/JobMakeCommand.php
Expand Up @@ -45,7 +45,7 @@ protected function getStub()
/**
* Resolve the fully-qualified path to the stub.
*
* @param string $stub
* @param string $stub
* @return string
*/
protected function resolveStubPath($stub)
Expand All @@ -58,7 +58,7 @@ protected function resolveStubPath($stub)
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
Expand Down
8 changes: 4 additions & 4 deletions app/Base/Console/Commands/ListenerMakeCommand.php
Expand Up @@ -2,8 +2,8 @@

namespace App\Base\Console\Commands;

use Illuminate\Console\GeneratorCommand;
use Illuminate\Support\Str;
use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Input\InputOption;

class ListenerMakeCommand extends GeneratorCommand
Expand Down Expand Up @@ -34,7 +34,7 @@ class ListenerMakeCommand extends GeneratorCommand
/**
* Build the class with the given name.
*
* @param string $name
* @param string $name
* @return string
*/
protected function buildClass($name)
Expand Down Expand Up @@ -79,7 +79,7 @@ protected function getStub()
/**
* Determine if the class already exists.
*
* @param string $rawName
* @param string $rawName
* @return bool
*/
protected function alreadyExists($rawName)
Expand All @@ -90,7 +90,7 @@ protected function alreadyExists($rawName)
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
Expand Down
4 changes: 2 additions & 2 deletions app/Base/Console/Commands/MailMakeCommand.php
Expand Up @@ -65,7 +65,7 @@ protected function writeMarkdownTemplate()
/**
* Build the class with the given name.
*
* @param string $name
* @param string $name
* @return string
*/
protected function buildClass($name)
Expand Down Expand Up @@ -94,7 +94,7 @@ protected function getStub()
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
Expand Down

0 comments on commit a3be265

Please sign in to comment.