diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-10-01 08:32:24 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-10-01 08:32:24 +0200 |
commit | 8f2600a0ea602ad5af76d5a7f5fe454c3812e336 (patch) | |
tree | 88a399690e46fb53bf5bc4c84e6db08241fdd357 | |
parent | cc0812332c2641e15fadbaf3241b9a9f61272a27 (diff) | |
download | nextcloud-server-8f2600a0ea602ad5af76d5a7f5fe454c3812e336.tar.gz nextcloud-server-8f2600a0ea602ad5af76d5a7f5fe454c3812e336.zip |
Also delete all shares before the test, so the count matches
-rw-r--r-- | tests/lib/repair/repairinvalidsharestest.php (renamed from tests/lib/repair/repairinvalidshares.php) | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/tests/lib/repair/repairinvalidshares.php b/tests/lib/repair/repairinvalidsharestest.php index f5b522f6b4f..89a5ba470e1 100644 --- a/tests/lib/repair/repairinvalidshares.php +++ b/tests/lib/repair/repairinvalidsharestest.php @@ -5,14 +5,20 @@ * later. * See the COPYING-README file. */ + namespace Test\Repair; + +use OC\Repair\RepairInvalidShares; +use OC\Share\Constants; +use Test\TestCase; + /** * Tests for repairing invalid shares * * @see \OC\Repair\RepairInvalidShares */ -class RepairInvalidShares extends \Test\TestCase { +class RepairInvalidSharesTest extends TestCase { /** @var \OC\RepairStep */ private $repair; @@ -32,17 +38,23 @@ class RepairInvalidShares extends \Test\TestCase { ->will($this->returnValue('8.0.0.0')); $this->connection = \OC::$server->getDatabaseConnection(); + $this->deleteAllShares(); - $this->repair = new \OC\Repair\RepairInvalidShares($config, $this->connection); + /** @var \OCP\IConfig $config */ + $this->repair = new RepairInvalidShares($config, $this->connection); } protected function tearDown() { - $qb = $this->connection->getQueryBuilder(); - $qb->delete('share')->execute(); + $this->deleteAllShares(); parent::tearDown(); } + protected function deleteAllShares() { + $qb = $this->connection->getQueryBuilder(); + $qb->delete('share')->execute(); + } + /** * Test remove expiration date for non-link shares */ @@ -51,7 +63,7 @@ class RepairInvalidShares extends \Test\TestCase { $qb = $this->connection->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OC\Share\Constants::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(Constants::SHARE_TYPE_USER), 'share_with' => $qb->expr()->literal('recipientuser1'), 'uid_owner' => $qb->expr()->literal('user1'), 'item_type' => $qb->expr()->literal('folder'), @@ -77,7 +89,7 @@ class RepairInvalidShares extends \Test\TestCase { $qb = $this->connection->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OC\Share\Constants::SHARE_TYPE_LINK), + 'share_type' => $qb->expr()->literal(Constants::SHARE_TYPE_LINK), 'uid_owner' => $qb->expr()->literal('user1'), 'item_type' => $qb->expr()->literal('folder'), 'item_source' => $qb->expr()->literal(123), |