CollectionTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * PHP Version 5.4
  4. *
  5. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  6. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  7. *
  8. * Licensed under The MIT License
  9. * For full copyright and license information, please see the LICENSE.txt
  10. * Redistributions of files must retain the above copyright notice.
  11. *
  12. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  13. * @link http://cakephp.org CakePHP(tm) Project
  14. * @since CakePHP(tm) v 3.0.0
  15. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  16. */
  17. namespace Cake\Test\TestCase\Database\Schema;
  18. use Cake\Core\Configure;
  19. use Cake\Database\ConnectionManager;
  20. use Cake\Database\Schema\Collection;
  21. use Cake\Database\Schema\Table;
  22. use Cake\TestSuite\TestCase;
  23. /**
  24. * Test case for Collection
  25. */
  26. class CollectionTest extends TestCase {
  27. /**
  28. * Setup function
  29. *
  30. * @return void
  31. */
  32. public function setUp() {
  33. parent::setUp();
  34. $this->connection = ConnectionManager::get('test');
  35. }
  36. /**
  37. * Teardown function
  38. *
  39. * @return void
  40. */
  41. public function tearDown() {
  42. parent::tearDown();
  43. unset($this->connection);
  44. }
  45. /**
  46. * Test that describing non-existent tables fails.
  47. *
  48. * Tests for positive describe() calls are in each platformSchema
  49. * test case.
  50. *
  51. * @expectedException Cake\Database\Exception
  52. * @return void
  53. */
  54. public function testDescribeIncorrectTable() {
  55. $schema = new Collection($this->connection);
  56. $this->assertNull($schema->describe('derp'));
  57. }
  58. }