FixturizedTestCase.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Cake\Test\Fixture;
  3. use Cake\TestSuite\TestCase;
  4. /**
  5. * This class helps in testing the life-cycle of fixtures inside a CakeTestCase
  6. *
  7. */
  8. class FixturizedTestCase extends TestCase
  9. {
  10. /**
  11. * Fixtures to use in this test
  12. * @var array
  13. */
  14. public $fixtures = ['core.categories'];
  15. /**
  16. * test that the shared fixture is correctly set
  17. *
  18. * @return void
  19. */
  20. public function testFixturePresent()
  21. {
  22. $this->assertInstanceOf('Cake\TestSuite\Fixture\FixtureManager', $this->fixtureManager);
  23. }
  24. /**
  25. * test that it is possible to load fixtures on demand
  26. *
  27. * @return void
  28. */
  29. public function testFixtureLoadOnDemand()
  30. {
  31. $this->loadFixtures('Categories');
  32. }
  33. /**
  34. * test that a test is marked as skipped using skipIf and its first parameter evaluates to true
  35. *
  36. * @return void
  37. */
  38. public function testSkipIfTrue()
  39. {
  40. $this->skipIf(true);
  41. }
  42. /**
  43. * test that a test is not marked as skipped using skipIf and its first parameter evaluates to false
  44. *
  45. * @return void
  46. */
  47. public function testSkipIfFalse()
  48. {
  49. $this->skipIf(false);
  50. }
  51. /**
  52. * test that a fixtures are unloaded even if the test throws exceptions
  53. *
  54. * @return void
  55. * @throws \Exception
  56. */
  57. public function testThrowException()
  58. {
  59. throw new \Exception();
  60. }
  61. }