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.

61 lines
1.9KB

  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  5. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  6. *
  7. * Licensed under The MIT License
  8. * For full copyright and license information, please see the LICENSE.txt
  9. * Redistributions of files must retain the above copyright notice.
  10. *
  11. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  12. * @link https://cakephp.org CakePHP(tm) Project
  13. * @since 3.0.0
  14. * @license https://opensource.org/licenses/mit-license.php MIT License
  15. */
  16. use Cake\Chronos\Chronos;
  17. use Cake\Core\Configure;
  18. use Cake\TestSuite\ConnectionHelper;
  19. use Migrations\TestSuite\Migrator;
  20. /**
  21. * Test runner bootstrap.
  22. *
  23. * Add additional configuration/setup your application needs when running
  24. * unit tests in this file.
  25. */
  26. require dirname(__DIR__) . '/vendor/autoload.php';
  27. require dirname(__DIR__) . '/config/bootstrap.php';
  28. if (empty($_SERVER['HTTP_HOST']) && !Configure::read('App.fullBaseUrl')) {
  29. Configure::write('App.fullBaseUrl', 'http://localhost');
  30. }
  31. // Fixate now to avoid one-second-leap-issues
  32. Chronos::setTestNow(Chronos::now());
  33. // Fixate sessionid early on, as php7.2+
  34. // does not allow the sessionid to be set after stdout
  35. // has been written to.
  36. session_id('cli');
  37. // Connection aliasing needs to happen before migrations are run.
  38. // Otherwise, table objects inside migrations would use the default datasource
  39. ConnectionHelper::addTestAliases();
  40. // Use migrations to build test database schema.
  41. //
  42. // Will rebuild the database if the migration state differs
  43. // from the migration history in files.
  44. //
  45. // If you are not using CakePHP's migrations you can
  46. // hook into your migration tool of choice here or
  47. // load schema from a SQL dump file with
  48. // use Cake\TestSuite\Fixture\SchemaLoader;
  49. // (new SchemaLoader())->loadSqlFiles('./tests/schema.sql', 'test');
  50. (new Migrator())->run();

Powered by TurnKey Linux.