diff --git a/.env.testing b/.env.testing new file mode 100644 index 00000000..3359d6de --- /dev/null +++ b/.env.testing @@ -0,0 +1,57 @@ +APP_NAME=Laravel +APP_ENV=local +APP_KEY=base64:V7wAIAWbUyjUVdv/YlP/MKqy2MbgDm4/YWEI2Y05W+Y= +APP_DEBUG=true +APP_URL=http://localhost + +LOG_CHANNEL=stack +LOG_LEVEL=debug + +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=shpping_portal +DB_USERNAME=root +DB_PASSWORD=P@ssw0rd + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +FILESYSTEM_DRIVER=local +QUEUE_CONNECTION=sync +SESSION_DRIVER=file +SESSION_LIFETIME=120 + +MEMCACHED_HOST=127.0.0.1 + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_MAILER=smtp +MAIL_HOST=mailhog +MAIL_PORT=1025 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS=null +MAIL_FROM_NAME="${APP_NAME}" + +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_DEFAULT_REGION=us-east-1 +AWS_BUCKET= +AWS_USE_PATH_STYLE_ENDPOINT=false + +PUSHER_APP_ID= +PUSHER_APP_KEY= +PUSHER_APP_SECRET= +PUSHER_APP_CLUSTER=mt1 + +MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" + +UNITY_APP_URL="https://unity.izyim.com" +EXCHANGE_URL=https://dev.exchange.cief-malaysia.com/ +MIX_EXCHANGE_URL="${EXCHANGE_URL}" + +YD_API_CODE='' diff --git a/codeception.yml b/codeception.yml new file mode 100644 index 00000000..f0446cc8 --- /dev/null +++ b/codeception.yml @@ -0,0 +1,10 @@ +paths: + tests: tests + output: tests/_output + data: tests/_data + support: tests/_support + envs: tests/_envs +actor_suffix: Tester +extensions: + enabled: + - Codeception\Extension\RunFailed diff --git a/composer.json b/composer.json index af20f32d..26ad972a 100644 --- a/composer.json +++ b/composer.json @@ -2,14 +2,17 @@ "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", - "keywords": ["framework", "laravel"], + "keywords": [ + "framework", + "laravel" + ], "license": "MIT", "require": { "php": "^7.3", "ext-fileinfo": "^7.3", "ext-json": "*", "barryvdh/laravel-dompdf": "^0.9.0", - "carlos-meneses/laravel-mpdf": "^2.1", + "carlos-meneses/laravel-mpdf": "*", "doctrine/dbal": "^3.1", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", @@ -25,6 +28,12 @@ "tymon/jwt-auth": "^1.0" }, "require-dev": { + "codeception/codeception": "^4.2", + "codeception/module-asserts": "^2.0", + "codeception/module-laravel": "^2.3", + "codeception/module-phpbrowser": "^2.0", + "codeception/module-rest": "^2.0", + "codeception/module-webdriver": "^2.0", "facade/ignition": "^2.5", "fakerphp/faker": "^1.9.1", "laravel/sail": "^1.0.1", diff --git a/phpunit.xml b/phpunit.xml index 4ae4d979..76a606bb 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -21,8 +21,8 @@ - - + + diff --git a/tests/TestCase.php b/tests/TestCase.php index 2932d4a6..641ccc27 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,9 +2,40 @@ namespace Tests; +use Faker\Factory as Faker; +use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; +use Illuminate\Support\Facades\Artisan; abstract class TestCase extends BaseTestCase { - use CreatesApplication; + + use CreatesApplication, RefreshDatabase; + + protected $faker; + + + /** + * Sets up the tests + */ + public function setUp(): void + { + parent::setUp(); + + $this->faker = Faker::create(); + + Artisan::call('migrate'); // runs the migration + } + + + /** + * Rolls back migrations + */ + public function tearDown(): void + { + Artisan::call('migrate:rollback'); + + parent::tearDown(); + } + } diff --git a/tests/_data/.gitkeep b/tests/_data/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/tests/_output/.gitignore b/tests/_output/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/tests/_output/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/tests/_support/FunctionalTester.php b/tests/_support/FunctionalTester.php new file mode 100644 index 00000000..f7bb0cd3 --- /dev/null +++ b/tests/_support/FunctionalTester.php @@ -0,0 +1,26 @@ +