api de gestion de ticket, basé sur php-crud-api. Le but est de décorrélé les outils de gestion des données, afin
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TestBase.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Mevdschee\PhpCrudApi\Tests;
  3. use PHPUnit\Framework\TestCase;
  4. abstract class TestBase extends TestCase
  5. {
  6. public static function setUpBeforeClass()
  7. {
  8. $name = static::getEngineName();
  9. if (!class_exists('Mevdschee\PhpCrudApi\Tests\Config')) {
  10. die("Configuration in 'Config.php' not found.\n");
  11. }
  12. if (!Config::$config || !isset(Config::$config[$name])) {
  13. self::markTestSkipped("Configuration in 'Config.php' not found.");
  14. }
  15. $config = Config::$config[$name];
  16. $db = static::connect($config);
  17. static::checkVersion($db);
  18. $capabilities = static::getCapabilities($db);
  19. static::seedDatabase($db, $capabilities);
  20. static::disconnect($db);
  21. // set params for test
  22. static::$config = $config;
  23. static::$capabilities = $capabilities;
  24. }
  25. public static $config;
  26. public static $capabilities;
  27. const GIS = 1;
  28. const JSON = 2;
  29. abstract public function getEngineName();
  30. abstract public function connect($db);
  31. abstract public function disconnect($db);
  32. abstract public function checkVersion($db);
  33. abstract public function getCapabilities($db);
  34. abstract public function seedDatabase($db, $capabilities);
  35. }