diff --git a/.env.testing b/.env.testing index bb05718ffc..3fb5010364 100644 --- a/.env.testing +++ b/.env.testing @@ -5,7 +5,7 @@ APP_TIMEZONE=UTC DB_CONNECTION=testing DB_TEST_DATABASE=portal_test -DB_TEST_USERNAME='root' +DB_TEST_USERNAME='mysql_test_user' DB_TEST_PASSWORD='root' CACHE_DRIVER=array diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index ccf6cc447d..96ca2ef542 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -5,56 +5,6 @@ on: branches: [master] jobs: - # phpcs: - # name: PHP CS - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Setup PHP v8.2 - # uses: shivammathur/setup-php@v2 - # with: - # php-version: "8.2" - # - name: Install composer dependencies - # run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - # - name: PHP Coding Standards - # run: PHP_CS_FIXER_IGNORE_ENV=1 php ./vendor/bin/php-cs-fixer fix --config .php-cs-fixer.php --dry-run --verbose --diff - - # eslint: - # name: ES Lint - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Setup PHP v8.2 - # uses: shivammathur/setup-php@v2 - # with: - # php-version: "8.2" - # - name: Install composer dependencies - # run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - # - name: Install NPM Dependencies - # run: npm install - # - name: ESLINT - # run: ./node_modules/.bin/eslint resources/js/ Modules/*/Resources/assets/js/ --ext .js,.vue - - # larastan: - # name: Larastan - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Setup PHP v8.2 - # uses: shivammathur/setup-php@v2 - # with: - # php-version: "8.2" - # - name: Install composer dependencies - # run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - # - name: Setup env file - # run: cp ./.env.example .env - # - name: Configure application encryption key - # run: php artisan key:generate - # - name: clear cache - # run: php artisan view:clear - # - name: Larastan - # run: ./vendor/bin/phpstan analyse - ColoredCowLaravelCI: name: ColoredCowLaravelCI runs-on: ubuntu-latest diff --git a/.github/workflows/integration-testing.yml b/.github/workflows/integration-testing.yml index ed27083da3..91aa4dc0ad 100644 --- a/.github/workflows/integration-testing.yml +++ b/.github/workflows/integration-testing.yml @@ -31,7 +31,7 @@ jobs: - name: Setup PHP v8.2 uses: shivammathur/setup-php@v2 with: - php-version: '8.2' + php-version: "8.2" - name: Setup cypress-testing uses: actions/checkout@v2 diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml new file mode 100644 index 0000000000..6135908043 --- /dev/null +++ b/.github/workflows/unit-testing.yml @@ -0,0 +1,71 @@ +name: Unit testing + +# Controls when the action will run. +on: + push: + branches: [master] + pull_request: + branches: [master] + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + portal: + runs-on: ubuntu-latest + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_USER: mysql_test_user + MYSQL_PASSWORD: root + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: portal_test + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # cypress setup + - name: Setup PHP v7.4 + uses: shivammathur/setup-php@v2 + with: + php-version: "7.4" + + - name: Setup unit-testing + uses: actions/checkout@v2 + + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.example', '.env');" + + - name: Install Dependencies + run: composer install + + - name: Generate key + run: php artisan key:generate + + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + + - name: Run migrations + run: | + php artisan migrate --env=testing + + - name: Run seeders + run: | + php artisan db:seed --env=testing + php artisan module:seed --env=testing + + - name: Compile assets + run: | + export NODE_OPTIONS=--openssl-legacy-provider + npm install + npm run dev + + - name: Run Test Suit + run: | + vendor/bin/phpunit --coverage-clover coverage.xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 diff --git a/.gitignore b/.gitignore index dcc1d3e2b6..620faab2fd 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,9 @@ cypress/screenshots google_service_credentials.json .phpunit.result.cache +.phpunit.result.cache/ + +# Unit test / coverage reports +coverage.xml +codecov +codecov/ diff --git a/.husky/_/.gitignore b/.husky/_/.gitignore deleted file mode 100644 index f59ec20aab..0000000000 --- a/.husky/_/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* \ No newline at end of file diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh deleted file mode 100644 index 5f7c17c20e..0000000000 --- a/.husky/_/husky.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -if [ -z "$husky_skip_init" ]; then - debug () { - [ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1" - } - - readonly hook_name="$(basename "$0")" - debug "starting $hook_name..." - - if [ "$HUSKY" = "0" ]; then - debug "HUSKY env variable is set to 0, skipping hook" - exit 0 - fi - - if [ -f ~/.huskyrc ]; then - debug "sourcing ~/.huskyrc" - . ~/.huskyrc - fi - - export readonly husky_skip_init=1 - sh -e "$0" "$@" - exitCode="$?" - - if [ $exitCode != 0 ]; then - echo "husky - $hook_name hook exited with code $exitCode (error)" - fi - - exit $exitCode -fi diff --git a/.husky/_/pre-commit b/.husky/_/pre-commit deleted file mode 100644 index 36af219892..0000000000 --- a/.husky/_/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npx lint-staged diff --git a/.phpunit.result.cache b/.phpunit.result.cache deleted file mode 100644 index a5091659c3..0000000000 --- a/.phpunit.result.cache +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"defects":{"Tests\\Feature\\ExampleTest::test_example":4,"Tests\\Unit\\HR\\ApplicantTest::test_create_applicant":3},"times":{"Tests\\Unit\\ExampleTest::test_example":0.302,"Tests\\Feature\\ExampleTest::test_example":3.062,"Tests\\Unit\\HR\\ApplicationTest::test_example":0.128,"Tests\\Unit\\HR\\ApplicantTest::test_example":0.121,"Tests\\Unit\\HR\\ApplicantTest::test_example_2":0.13,"Tests\\Unit\\HR\\ApplicantTest::test_create_applicant":0.138,"Tests\\Feature\\HR\\ExampleTest::test_example":0.152}} \ No newline at end of file diff --git a/Modules/HR/Database/Seeders/HRDatabaseSeeder.php b/Modules/HR/Database/Seeders/HRDatabaseSeeder.php index 7d7f0739d3..7f71cbc071 100644 --- a/Modules/HR/Database/Seeders/HRDatabaseSeeder.php +++ b/Modules/HR/Database/Seeders/HRDatabaseSeeder.php @@ -13,7 +13,7 @@ class HRDatabaseSeeder extends Seeder */ public function run() { - if (! app()->environment(['local', 'staging', 'UAT'])) { + if (! app()->environment(['local', 'staging', 'UAT', 'testing'])) { return 0; } $this->call(HRPermissionsTableSeeder::class); diff --git a/tests/Feature/HR/ApplicantTest.php b/Modules/HR/Tests/Feature/ApplicantTest.php similarity index 84% rename from tests/Feature/HR/ApplicantTest.php rename to Modules/HR/Tests/Feature/ApplicantTest.php index 2b4a093b9c..df985ae571 100644 --- a/tests/Feature/HR/ApplicantTest.php +++ b/Modules/HR/Tests/Feature/ApplicantTest.php @@ -1,11 +1,11 @@ first(); - } - - /** - * Checks if the user is super admin. - * - * @return bool - */ - public function isSuperAdmin() - { - return $this->hasRole('super-admin'); - } - - public static function scopeInterviewers($query) - { - return $query->where('provider', 'google'); - } - - public function getAvatarAttribute($value) - { - return $value ?: url('/images/default_profile.png'); - } - - public function books() - { - return $this->belongsToMany(Book::class, 'book_readers', 'user_id', 'library_book_id'); - } - - public function totalReadBooks() - { - return $this->books()->count(); - } - - public function getIsActiveEmployeeAttribute() - { - // The employees will have a GSuite ID. That means the provider will be google. - // Also, to make sure there's no false entry, we'll also check if the email - // contains the gsuite client hd parameter. - return $this->provider == 'google' && strpos($this->email, config('constants.gsuite.client-hd')) !== false; - } - - public function employee() - { - return $this->hasOne(Employee::class, 'user_id'); - } - - public function scopeFindByEmail($query, $email) - { - return $query->where('email', $email); - } -} diff --git a/config/database.php b/config/database.php index e3753b1a80..f9bc79bdf0 100644 --- a/config/database.php +++ b/config/database.php @@ -56,10 +56,10 @@ 'testing' => [ 'driver' => 'mysql', - 'host' => env('DB_TEST_HOST', '127.0.0.1'), + 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_TEST_DATABASE', 'portal_test'), - 'username' => env('DB_TEST_USERNAME', 'root'), + 'username' => env('DB_TEST_USERNAME', 'mysql_test_user'), 'password' => env('DB_TEST_PASSWORD', 'root'), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', diff --git a/coverage.xml b/coverage.xml new file mode 100644 index 0000000000..d63b210442 --- /dev/null +++ b/coverage.xml @@ -0,0 +1,8450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/database/Seeders/DatabaseSeeder.php b/database/Seeders/DatabaseSeeder.php index 4ddb8906f7..e3b20745db 100644 --- a/database/Seeders/DatabaseSeeder.php +++ b/database/Seeders/DatabaseSeeder.php @@ -15,7 +15,7 @@ class DatabaseSeeder extends Seeder */ public function run() { - if (! app()->environment(['local', 'staging', 'UAT'])) { + if (! app()->environment(['local', 'staging', 'UAT', 'testing'])) { return 0; } diff --git a/phpstan.neon b/phpstan.neon index 09e4caa7ee..49f07185fa 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -12,6 +12,8 @@ parameters: - Modules/*/vendor/composer/ClassLoader.php - Modules/*/Database/Factories/*.php # Ignore Error occurring due to Laravel factories - Modules/*/Database/Seeders/*.php # Ignore Error occurring due to Laravel factories + - Modules/*/Database/Seeders/*.php # Ignore Error occurring due to Laravel factories + - Modules/*/Tests/*.php # Ignore Error occurring due to Laravel factories # The level 8 is the highest level level: 5 diff --git a/phpunit.xml b/phpunit.xml index 97dde22fe8..a6dcc57c60 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -19,7 +19,15 @@ ./app + ./Modules/HR + + ./Modules + ./Modules/**/Routes + ./Modules/**/Resources + ./Modules/**/Tests + ./Modules/**/Config + diff --git a/resources/views/hr/application/create.blade.php b/resources/views/hr/application/create.blade.php index 6ebada1634..e0cc9d6104 100644 --- a/resources/views/hr/application/create.blade.php +++ b/resources/views/hr/application/create.blade.php @@ -1,172 +1,172 @@ -@extends('layouts.app') -@include('hr.application.excel-import') - -@section('content') -
-
-
-
- @include('hr.menu') -

-
-
- - - -
-

Add new application

-
- - - -
-
-
- @include('status', ['errors' => $errors->all()]) -
-
- @csrf -
-
-
-
-
- -
- - -
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
-
- - -
-
-
- -
- - -
-
- -
-
- - -
- -
- - -
- -
- - -
- - -
- - -
- -
- - -
- -
- - -
-
-
-
- - -
-
-
-
-@endsection +@extends('layouts.app') +@include('hr.application.excel-import') + +@section('content') +
+
+
+
+ @include('hr.menu') +

+
+
+ + + +
+

Add new application

+
+ + + +
+
+
+ @include('status', ['errors' => $errors->all()]) +
+
+ @csrf +
+
+
+
+
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+ + +
+
+
+ +
+ + +
+
+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+ + +
+
+
+
+@endsection diff --git a/tests/TestCase.php b/tests/TestCase.php index ac34a367df..60fc29648e 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -11,7 +11,7 @@ abstract class TestCase extends BaseTestCase protected function signIn($role = null) { - $user = create(User::class); + $user = User::factory()->create(); is_null($role) ?: $user->assignRole($role); $this->be($user);