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.1KB

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