1
0

dropoldtables.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Copyright (c) 2015 Joas Schilling <nickvergessen@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace Test\Repair;
  9. /**
  10. * Tests for the dropping old tables
  11. *
  12. * @see \OC\Repair\DropOldTables
  13. */
  14. class DropOldTables extends \Test\TestCase {
  15. /** @var \OCP\IDBConnection */
  16. protected $connection;
  17. protected function setUp() {
  18. parent::setUp();
  19. $this->connection = \OC::$server->getDatabaseConnection();
  20. $manager = new \OC\DB\MDB2SchemaManager($this->connection);
  21. $manager->createDbFromStructure(__DIR__ . '/fixtures/dropoldtables.xml');
  22. }
  23. public function testRun() {
  24. $this->assertFalse($this->connection->tableExists('sharing'), 'Asserting that the table oc_sharing does not exist before repairing');
  25. $this->assertTrue($this->connection->tableExists('permissions'), 'Asserting that the table oc_permissions does exist before repairing');
  26. $repair = new \OC\Repair\DropOldTables($this->connection);
  27. $repair->run();
  28. $this->assertFalse($this->connection->tableExists('sharing'), 'Asserting that the table oc_sharing does not exist after repairing');
  29. $this->assertFalse($this->connection->tableExists('permissions'), 'Asserting that the table oc_permissions does not exist after repairing');
  30. }
  31. }