phpunit.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /*
  3. *---------------------------------------------------------------
  4. * PHPUnit runner
  5. *---------------------------------------------------------------
  6. *
  7. * This file just loads CCF and all needed resources to run the
  8. * php unit tests. PHPUnit is a really elegant way to make sure
  9. * that everything works how it should.
  10. *
  11. *
  12. * force the environment to phpunit
  13. *
  14. * By default the the environment detector defines the current
  15. * environment. But you can force another one using the this var.
  16. */
  17. $environment = 'phpunit';
  18. /*
  19. *---------------------------------------------------------------
  20. * Require CCF
  21. *---------------------------------------------------------------
  22. *
  23. * load the framework file wich wil initialize CCF.
  24. */
  25. require_once __DIR__."/../framework.php";
  26. /*
  27. *---------------------------------------------------------------
  28. * CCUnit resources
  29. *---------------------------------------------------------------
  30. *
  31. * For the unit tests we need some additional resources like
  32. * controllers, views, ect...
  33. */
  34. CCOrbit::enter( COREPATH.'orbit/CCUnit' );
  35. // writ header
  36. CCCli::line("==============================
  37. _____ _____ ______
  38. / ____/ ____| ____|
  39. | | | | | |__
  40. | | | | | __|
  41. | |___| |____| |
  42. \_____\_____|_| ramework
  43. ==============================
  44. ", 'cyan');
  45. // complete overwrite of DB configuration
  46. CCConfig::create( 'database' )->_data = CCConfig::create( 'Core::phpunit/database' )->_data;
  47. // delete all database table
  48. DB\Migrator::hard_reset();
  49. DB\Migrator::hard_reset( 'phpunit' );
  50. // run the migrations
  51. DB\Migrator::migrate( true );