index.php 1021B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. require_once dirname(__FILE__) . '/config.php';
  3. require_once SWEETY_SIMPLETEST_PATH . '/unit_tester.php';
  4. require_once SWEETY_SIMPLETEST_PATH . '/mock_objects.php';
  5. require_once SWEETY_SIMPLETEST_PATH . '/reporter.php';
  6. require_once SWEETY_SIMPLETEST_PATH . '/xml.php';
  7. require_once 'Sweety/Runner.php';
  8. require_once 'Sweety/Runner/HtmlRunner.php';
  9. require_once 'Sweety/Reporter/HtmlReporter.php';
  10. $runner = new Sweety_Runner_HtmlRunner(
  11. explode(PATH_SEPARATOR, SWEETY_TEST_PATH),
  12. SWEETY_UI_TEMPLATE,
  13. SWEETY_SUITE_NAME
  14. );
  15. $runner->setReporter(new Sweety_Reporter_HtmlReporter());
  16. $runner->setIgnoredClassRegex(SWEETY_IGNORED_CLASSES);
  17. $locators = preg_split('/\s*,\s*/', SWEETY_TEST_LOCATOR);
  18. foreach ($locators as $locator)
  19. {
  20. $runner->registerTestLocator(new $locator());
  21. }
  22. if (isset($_GET['test']))
  23. {
  24. $testName = $_GET['test'];
  25. $format = isset($_GET['format']) ? $_GET['format'] : Sweety_Runner::REPORT_HTML;
  26. $runner->runTestCase($testName, $format);
  27. }
  28. else
  29. {
  30. $runner->runAllTests();
  31. }