2lenet/crudit-bundle
Symfony bundle to rapidly build configurable CRUD back offices with SB Admin layout. Provides list views with pagination, sorting, actions, exports and batch ops, plus datasources, filters, menus, workflows, maps, markdown and Twig helpers.
Crudit gives you some helper traits in order to test your app.
A navigation test is provided. The test will navigate on every crud that appear in the menu. To enable the test create a new class in the tests directory :
#/tests/NavigationTest.php
<?php
namespace App\Tests;
use App\Repository\UserRepository;
use Lle\CruditBundle\Test\TestHelperTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class NavigationTest extends WebTestCase
{
use TestHelperTrait;
public const EXCLUDED_ROUTES = ['hermes'];
public const LOGIN_USER = 'admin@app.fr';
public const USER_REPOSITORY = UserRepository::class;
}
There is 3 constants to setup in order to configure the test :
EXCLUDED_ROUTES The test will not access these routes.LOGIN_USER The user to be used in the tests. Make sure that this user has the rights to access every pages.USER_REPOSITORY The repository that manages users in the app.The filter test will be useful to check that your filters are well configured.
Here is the class to set up:
#/tests/FiltersTest.php
<?php
namespace App\Tests;
use App\Repository\UserRepository;
use Lle\CruditBundle\Test\FilterTestHelperTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class FiltersTest extends WebTestCase
{
use FilterTestHelperTrait;
public const LOGIN_USER = 'admin@app.fr';
public const USER_REPOSITORY = UserRepository::class;
}
There is 2 constants to setup in order to configure the test :
LOGIN_USER The user to be used in the tests. Make sure that this user has the rights to access every pages.USER_REPOSITORY The repository that manages users in the app.To test the sort actions on the cruds, you can use the sortable test.
Here is the configuration:
#/tests/SortableTest.php
<?php
namespace App\Tests;
use Lle\CruditBundle\Test\TestSortableHelperTrait;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class SortableTest extends KernelTestCase
{
use TestSortableHelperTrait;
}
How can I help you explore Laravel packages today?