FixturizedTestCase.php 1.4 KB

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