Allow to restrict the file extensions for a attachment type.

This commit is contained in:
Jan Böhmer 2019-10-31 22:37:54 +01:00
parent 2187f5eac2
commit fdfb099cb5
25 changed files with 714 additions and 4 deletions

View file

@ -38,6 +38,10 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Security\Core\Security;
/**
* @group slow
* @package App\Tests\Controller\AdminPages
*/
abstract class AbstractAdminControllerTest extends WebTestCase
{
protected static $base_path = 'not_valid';
@ -62,6 +66,7 @@ abstract class AbstractAdminControllerTest extends WebTestCase
/**
* @dataProvider readDataProvider
* @group slow
* Tests if you can access the /new part which is used to list all entities. Checks if permissions are working
*/
public function testListEntries(string $user, bool $read)
@ -81,6 +86,7 @@ abstract class AbstractAdminControllerTest extends WebTestCase
/**
* @dataProvider readDataProvider
* @group slow
* Tests if it possible to access an specific entity. Checks if permissions are working.
*/
public function testReadEntity(string $user, bool $read)
@ -110,6 +116,7 @@ abstract class AbstractAdminControllerTest extends WebTestCase
/**
* Tests if deleting an entity is working.
* @group slow
* @dataProvider deleteDataProvider
*/
public function testDeleteEntity(string $user, bool $delete)

View file

@ -34,6 +34,10 @@ namespace App\Tests\Controller\AdminPages;
use App\Entity\Attachments\AttachmentType;
/**
* @group slow
* @package App\Tests\Controller\AdminPages
*/
class AttachmentTypeControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en' . '/attachment_type';

View file

@ -33,6 +33,10 @@ namespace App\Tests\Controller\AdminPages;
use App\Entity\Parts\Category;
/**
* @group slow
* @package App\Tests\Controller\AdminPages
*/
class CategoryControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en' . '/category';

View file

@ -35,6 +35,10 @@ namespace App\Tests\Controller\AdminPages;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Devices\Device;
/**
* @group slow
* @package App\Tests\Controller\AdminPages
*/
class DeviceControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en' . '/device';

View file

@ -35,6 +35,10 @@ namespace App\Tests\Controller\AdminPages;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Parts\Footprint;
/**
* @group slow
* @package App\Tests\Controller\AdminPages
*/
class FootprintControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en' . '/footprint';

View file

@ -36,6 +36,10 @@ use App\Entity\Attachments\AttachmentType;
use App\Entity\Devices\Device;
use App\Entity\Parts\Manufacturer;
/**
* @group slow
* @package App\Tests\Controller\AdminPages
*/
class ManufacturerControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en' . '/manufacturer';

View file

@ -37,6 +37,10 @@ use App\Entity\Devices\Device;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
/**
* @group slow
* @package App\Tests\Controller\AdminPages
*/
class MeasurementUnitControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en' . '/measurement_unit';

View file

@ -38,6 +38,10 @@ use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Storelocation;
use Symfony\Component\HttpKernel\HttpCache\Store;
/**
* @group slow
* @package App\Tests\Controller\AdminPages
*/
class StorelocationControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en' . '/store_location';

View file

@ -37,6 +37,10 @@ use App\Entity\Devices\Device;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Supplier;
/**
* @group slow
* @package App\Tests\Controller\AdminPages
*/
class SupplierControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en' . '/supplier';

View file

@ -36,6 +36,10 @@ use Doctrine\ORM\EntityManagerInterface;
use Proxies\__CG__\App\Entity\UserSystem\User;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @group slow
* @package App\Tests\Controller
*/
class RedirectControllerTest extends WebTestCase
{
protected $em;
@ -65,6 +69,7 @@ class RedirectControllerTest extends WebTestCase
/**
* Test if a certain request to an url will be redirected.
* @dataProvider urlMatchDataProvider
* @group slow
*/
public function testUrlMatch($url, $expect_redirect)
{
@ -95,6 +100,7 @@ class RedirectControllerTest extends WebTestCase
/**
* Test if the user is redirected to the localized version of a page, based on his settings.
* @dataProvider urlAddLocaleDataProvider
* @group slow
* @depends testUrlMatch
* @param $user_locale
* @param $input_path
@ -124,6 +130,7 @@ class RedirectControllerTest extends WebTestCase
/**
* Test if the user is redirected to password change page if he should do that
* @depends testAddLocale
* @group slow
* @testWith ["de"]
* ["en"]
*/