No description
Find a file
Stefan Lindecke 8f7f38a2ee updates
2025-06-13 13:37:26 +02:00
.ddev initial 2025-06-03 20:29:36 +02:00
.idea updates 2025-06-13 13:37:26 +02:00
assets initial 2025-06-03 20:29:36 +02:00
bin initial 2025-06-03 20:29:36 +02:00
config updates 2025-06-13 13:37:26 +02:00
migrations initial 2025-05-31 20:29:31 +02:00
public Add initial set of files 2025-05-31 13:15:02 +02:00
src updates 2025-06-13 13:37:26 +02:00
templates zeugs 2025-06-13 12:26:16 +02:00
tests initial 2025-06-03 20:29:36 +02:00
.editorconfig Add initial set of files 2025-05-31 13:15:02 +02:00
.env initial 2025-05-31 18:28:52 +02:00
.env.dev Add initial set of files 2025-05-31 13:15:02 +02:00
.env.test initial 2025-06-03 20:29:36 +02:00
.gitignore initial 2025-06-04 13:13:44 +02:00
compose.override.yaml initial 2025-05-31 18:29:01 +02:00
compose.yaml initial 2025-05-31 18:29:01 +02:00
composer.json updates 2025-06-13 13:37:26 +02:00
composer.lock initial 2025-06-04 13:13:44 +02:00
ecs.php initial 2025-06-03 20:29:36 +02:00
example_data.sql updates 2025-06-13 13:37:26 +02:00
package-lock.json initial 2025-06-04 13:13:44 +02:00
package.json initial 2025-06-04 13:13:44 +02:00
phpunit.xml.dist initial 2025-06-03 20:29:36 +02:00
README.md initial 2025-06-03 20:29:36 +02:00
symfony.lock initial 2025-06-04 13:13:44 +02:00
time.log initial 2025-06-03 20:29:36 +02:00
vite.config.js initial 2025-06-04 13:13:44 +02:00

Vite Integration with Bootstrap and Select2

This project uses Vite as a frontend build tool to compile and serve Bootstrap and Select2 assets locally.

Setup

Install Dependencies

# Install PHP dependencies
composer install

# Install JavaScript dependencies
npm install

Development

To start the Vite development server:

npm run dev

This will start a development server at http://localhost:5173 that will automatically reload when you make changes to your assets.

Production Build

To build the assets for production:

npm run build

This will compile and minify your assets and place them in the public/build directory.

Usage

Bootstrap

Bootstrap is available globally through the bootstrap variable:

// Show a modal
const myModal = new bootstrap.Modal(document.getElementById('myModal'));
myModal.show();

Select2

Select2 is initialized automatically for elements with the select2 class:

<select class="select2">
  <option value="option1">Option 1</option>
  <option value="option2">Option 2</option>
</select>

You can also initialize Select2 manually:

$('#mySelect').select2();

Asset Structure

  • assets/app.js: Main entry point for JavaScript
  • assets/styles/app.css: Main entry point for CSS

Configuration

  • Vite configuration: vite.config.js
  • Symfony Vite Bundle configuration: config/packages/pentatrion_vite.yaml

Testing

This project includes functional tests that verify all accessible pages can be accessed by the appropriate user roles.

Running Tests

To run the tests, you can use one of the following methods:

Using Composer

# Run all tests
composer test

# Run tests with code coverage report (saved to var/coverage/)
composer test-coverage

Using the Shell Script

bin/run-tests.sh

This script will:

  1. Install the test dependencies
  2. Create a test database if it doesn't exist
  3. Run migrations on the test database
  4. Run the tests using PHPUnit

Running Specific Tests

# Using PHPUnit directly
php bin/phpunit tests/Controller/HelloWorldControllerTest.php

# Or with a specific test method
php bin/phpunit --filter testIndexAsUser tests/Controller/HelloWorldControllerTest.php

Test Coverage

The tests cover all controllers and routes in the application, verifying access for:

  • Anonymous users
  • Users with ROLE_USER
  • Users with ROLE_ADMIN

For more details about the test coverage, see the tests/README.md file.

Code Quality

Easy Coding Standard (ECS)

This project uses Easy Coding Standard to ensure consistent code style following Symfony standards.

Check Code Style

To check your code for style violations:

composer check-cs

Fix Code Style

To automatically fix code style violations:

composer fix-cs

The ECS configuration is defined in ecs.php in the project root.