DatabaseSuite.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * PHP Version 5.4
  4. *
  5. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  6. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  7. *
  8. * Licensed under The MIT License
  9. * For full copyright and license information, please see the LICENSE.txt
  10. * Redistributions of files must retain the above copyright notice.
  11. *
  12. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  13. * @link http://cakephp.org CakePHP(tm) Project
  14. * @since CakePHP(tm) v 3.0.0
  15. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  16. */
  17. namespace Cake\Test\TestCase;
  18. use Cake\Database\ConnectionManager;
  19. use Cake\TestSuite\TestPermutationDecorator;
  20. use Cake\TestSuite\TestSuite;
  21. /**
  22. * All tests related to database
  23. *
  24. */
  25. class DatabaseSuite extends TestSuite {
  26. /**
  27. * Returns a suite containing all tests requiring a database connection,
  28. * tests are decorated so that they are run once with automatic
  29. *
  30. * @return void
  31. */
  32. public static function suite() {
  33. $suite = new TestSuite('Database related tests');
  34. $suite->addTestDirectoryRecursive(__DIR__ . DS . 'Database');
  35. $suite->addTestDirectoryRecursive(__DIR__ . DS . 'ORM');
  36. $permutations = [
  37. 'Identifier Quoting' => function() {
  38. ConnectionManager::get('test')->driver()->autoQuoting(true);
  39. },
  40. 'No identifier quoting' => function() {
  41. ConnectionManager::get('test')->driver()->autoQuoting(false);
  42. }
  43. ];
  44. $suite = new TestPermutationDecorator($suite, $permutations);
  45. return $suite;
  46. }
  47. }