Skip to content

Commit 54186fc

Browse files
author
farhadzand
committed
remove mongodb driver
1 parent db066f4 commit 54186fc

File tree

4 files changed

+109
-45
lines changed

4 files changed

+109
-45
lines changed

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ jobs:
2929
tools: composer:v2
3030

3131
- name: Setup problem matchers
32-
run: |
33-
echo "::add-matcher::/opt/hostedtoolcache/php.json"
32+
run: echo "::add-matcher::/opt/hostedtoolcache/php.json"
3433

3534
- name: Get composer cache directory
3635
id: composer-cache

.github/workflows/laravel-integration.yml

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,27 @@ jobs:
4040
tools: composer:v2
4141

4242
- name: Create Laravel app
43-
run: |
44-
composer create-project laravel/laravel:${{ matrix.laravel }} laravel-app --prefer-dist --no-interaction
45-
cd laravel-app
46-
composer require laravel/pint --dev
43+
run: composer create-project laravel/laravel:${{ matrix.laravel }} laravel-app --prefer-dist --no-interaction
44+
45+
- name: Install Laravel Pint
46+
working-directory: laravel-app
47+
run: composer require laravel/pint --dev
4748

4849
- name: Install package from path
49-
run: |
50-
cd laravel-app
51-
composer config repositories.local path "../"
52-
composer require iamfarhad/laravel-audit-log:@dev --no-interaction
50+
working-directory: laravel-app
51+
run: composer config repositories.local path "../" && composer require iamfarhad/laravel-audit-log:@dev --no-interaction
5352

5453
- name: Publish config
55-
run: |
56-
cd laravel-app
57-
php artisan vendor:publish --provider="iamfarhad\\LaravelAuditLog\\AuditLoggerServiceProvider"
54+
working-directory: laravel-app
55+
run: php artisan vendor:publish --provider="iamfarhad\\LaravelAuditLog\\AuditLoggerServiceProvider"
5856

5957
- name: Create sample migration and model
60-
run: |
61-
cd laravel-app
62-
php artisan make:model TestModel -m
58+
working-directory: laravel-app
59+
run: php artisan make:model TestModel -m
6360

6461
- name: Add Auditable trait to model
62+
working-directory: laravel-app
6563
run: |
66-
cd laravel-app
6764
cat > app/Models/TestModel.php << 'EOL'
6865
<?php
6966
@@ -85,18 +82,16 @@ jobs:
8582
EOL
8683
8784
- name: Update migration
88-
run: |
89-
cd laravel-app
90-
find database/migrations -name "*_create_test_models_table.php" -exec sed -i 's/Schema::create/\$table->string("name")->nullable();\n Schema::create/g' {} \;
85+
working-directory: laravel-app
86+
run: find database/migrations -name "*_create_test_models_table.php" -exec sed -i 's/Schema::create/\$table->string("name")->nullable();\n Schema::create/g' {} \;
9187

9288
- name: Run migrations
93-
run: |
94-
cd laravel-app
95-
php artisan migrate
89+
working-directory: laravel-app
90+
run: php artisan migrate
9691

9792
- name: Create basic test
93+
working-directory: laravel-app
9894
run: |
99-
cd laravel-app
10095
cat > tests/Feature/AuditLogTest.php << 'EOL'
10196
<?php
10297
@@ -146,6 +141,5 @@ jobs:
146141
EOL
147142
148143
- name: Run tests
149-
run: |
150-
cd laravel-app
151-
php artisan test
144+
working-directory: laravel-app
145+
run: php artisan test

.github/workflows/tests.yml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ jobs:
4646
tools: composer:v2
4747

4848
- name: Setup problem matchers
49-
run: |
50-
echo "::add-matcher::/opt/hostedtoolcache/php.json"
51-
echo "::add-matcher::/opt/hostedtoolcache/phpunit.json"
49+
run: echo "::add-matcher::/opt/hostedtoolcache/php.json" && echo "::add-matcher::/opt/hostedtoolcache/phpunit.json"
5250

5351
- name: Get composer cache directory
5452
id: composer-cache
@@ -63,25 +61,19 @@ jobs:
6361
${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}-${{ hashFiles('**/composer.json') }}-
6462
${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}-
6563
66-
- name: Update composer.json for Laravel version
67-
run: |
68-
# Update testbench version for Laravel 12
69-
if [[ "${{ matrix.laravel }}" == "12.*" ]]; then
70-
composer require --no-update "orchestra/testbench:^10.0" --dev
71-
fi
72-
73-
# Update testbench version for Laravel 11
74-
if [[ "${{ matrix.laravel }}" == "11.*" ]]; then
75-
composer require --no-update "orchestra/testbench:^9.0" --dev
76-
fi
64+
- name: Update testbench for Laravel 12
65+
if: matrix.laravel == '12.*'
66+
run: composer require --no-update "orchestra/testbench:^10.0" --dev
67+
68+
- name: Update testbench for Laravel 11
69+
if: matrix.laravel == '11.*'
70+
run: composer require --no-update "orchestra/testbench:^9.0" --dev
7771

7872
- name: Install dependencies
79-
run: |
80-
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
81-
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
73+
run: composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update && composer update --${{ matrix.stability }} --prefer-dist --no-interaction
8274

8375
- name: Run PHPUnit tests
84-
run: vendor/bin/phpunit --coverage-text --verbose
76+
run: vendor/bin/phpunit --coverage-text
8577

8678
- name: Run PHP Static Analysis
8779
if: ${{ matrix.stability == 'prefer-stable' }}

TESTING.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Testing Laravel Audit Logger
2+
3+
This document provides instructions for testing the Laravel Audit Logger package.
4+
5+
## Running Tests in Docker Environment
6+
7+
If you're using Docker for development, you can use the following Makefile commands from the project root:
8+
9+
```bash
10+
# Run PHPUnit tests with coverage
11+
make audit-test
12+
13+
# Run Laravel Pint code style check
14+
make audit-pint
15+
16+
# Fix code style issues with Laravel Pint
17+
make audit-pint-fix
18+
19+
# Run PHPStan static analysis
20+
make audit-analyse
21+
22+
# Run both Pint and PHPStan
23+
make audit-cs
24+
25+
# Run all tests (PHPUnit, Pint, and PHPStan)
26+
make audit-all
27+
```
28+
29+
## Running Tests Manually
30+
31+
If you prefer to run tests manually within the package directory:
32+
33+
```bash
34+
# Run PHPUnit tests
35+
composer test
36+
37+
# Run Laravel Pint code style check
38+
vendor/bin/pint --test
39+
40+
# Fix code style issues
41+
vendor/bin/pint
42+
43+
# Run PHPStan static analysis (with increased memory limit)
44+
php -d memory_limit=256M vendor/bin/phpstan analyse
45+
46+
# Run both Pint and PHPStan
47+
composer cs
48+
```
49+
50+
## Using the Testing Script
51+
52+
For an interactive testing experience, you can use the provided script:
53+
54+
```bash
55+
# From the project root
56+
docker compose exec app bash packages/audit-logger/docker-test.sh
57+
58+
# Or from the package directory
59+
./docker-test.sh
60+
```
61+
62+
This will provide an interactive menu with options to run different test suites.
63+
64+
## GitHub Actions Workflows
65+
66+
The package includes several GitHub Actions workflows for continuous integration:
67+
68+
1. **Tests**: Runs PHPUnit tests across different PHP and Laravel versions.
69+
2. **Coding Standards**: Checks code style using Laravel Pint.
70+
3. **PHPStan Static Analysis**: Performs static analysis using PHPStan.
71+
4. **Laravel Integration Test**: Tests the package in a real Laravel application.
72+
73+
These workflows run automatically on push to main/master branches, on pull requests, and on scheduled intervals.
74+
75+
## Notes
76+
77+
- When running PHPStan, you may need to increase the PHP memory limit if you encounter memory issues.
78+
- For test coverage reports, ensure Xdebug is installed and enabled with coverage mode.
79+
- Tests are run with `XDEBUG_MODE=coverage` to enable coverage reports.

0 commit comments

Comments
 (0)