Follow these instructions to set up the project.
-
Clone the repository:
git clone "git@github.com:Fabdoc27/Barta.git" -
Navigate to the project directory:
cd "Barta"
-
Install PHP dependencies:
composer install
-
Install Node.js dependencies:
npm install
-
Create the environment file:
cp .env.example .env
-
Generate the application key:
php artisan key:generate
-
Run database migrations:
php artisan migrate
-
Start the local development server:
php artisan serve
-
Compile front-end assets:
npm run dev
Follow these steps to set up and run the tests.
-
Create a
.env.testingfile:cp .env.example .env.testing
-
Generate the application key for the testing environment:
php artisan key:generate --env=testing
-
Create the
test.sqlitefile:touch database/test.sqlite
-
Run database migrations with seeding for the testing environment:
php artisan migrate --seed --env=testing
-
Configure the
phpunit.xmlfile to use SQLite for testing:Add the following lines in the
<php>section of thephpunit.xmlfile:<env name="DB_CONNECTION" value="sqlite"/> <env name="DB_DATABASE" value="database/test.sqlite"/>
-
Ensure the testing database configuration is set in
config/database.php:This is already pre-configured:
'testing' => [ 'driver' => 'sqlite', 'url' => env('DB_URL'), 'database' => env('DB_DATABASE', database_path('test.sqlite')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 'busy_timeout' => null, 'journal_mode' => null, 'synchronous' => null, ],
-
Update the
.env.testingfile with the following variables:DB_CONNECTION=testing # DB_HOST=127.0.0.1 # DB_PORT=3306 # DB_DATABASE=laravel # DB_USERNAME=root # DB_PASSWORD=
-
Run the tests:
php artisan test