Integration.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Lithium: the most rad php framework
  4. *
  5. * @copyright Copyright 2013, Union of RAD (http://union-of-rad.org)
  6. * @license http://opensource.org/licenses/bsd-license.php The BSD License
  7. */
  8. namespace lithium\test;
  9. /**
  10. * This is the base class for integration tests.
  11. *
  12. * Integration tests are for determining that different parts of the framework will work
  13. * together (integrate) as expected. An example of a common integration test would be for
  14. * ensuring that an adapter interacts correctly with the class it is designed to interface
  15. * with. Example: the `Session` class and the `Php` adapter. Unit tests will ensure that
  16. * both the `Session` and `Php` classes behave correctly under isolation, while an integration
  17. * test ensures that the two classes interact and interface correctly.
  18. */
  19. class Integration extends \lithium\test\Unit {
  20. /**
  21. * Auto init for applying Integration filter to this test class.
  22. *
  23. * @return void
  24. */
  25. protected function _init() {
  26. parent::_init();
  27. $this->applyFilter('run', function($self, $params, $chain) {
  28. $before = $self->results();
  29. $chain->next($self, $params, $chain);
  30. $after = $self->results();
  31. while (count($after) > count($before)) {
  32. $result = array_pop($after);
  33. if ($result['result'] === 'fail') {
  34. return false;
  35. }
  36. }
  37. });
  38. }
  39. }
  40. ?>