1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Tom Needham <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (c) 2017 ownCloud GmbH |
6
|
|
|
* @license AGPL-3.0 |
7
|
|
|
* |
8
|
|
|
* This code is free software: you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
10
|
|
|
* as published by the Free Software Foundation. |
11
|
|
|
* |
12
|
|
|
* This program is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU Affero General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
19
|
|
|
* |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace Tests\Core\Command\Migrate; |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
use OC\Core\Command\Migrate\DavProperties; |
26
|
|
|
use OC\Core\Command\User\Delete; |
27
|
|
|
use Test\TestCase; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Class DeleteTest |
31
|
|
|
* |
32
|
|
|
* @package Tests\Core\Command\Migrate |
33
|
|
|
* @group DB |
34
|
|
|
*/ |
35
|
|
|
class DeleteTest extends TestCase { |
36
|
|
|
/** @var \PHPUnit_Framework_MockObject_MockObject */ |
37
|
|
|
protected $userManager; |
38
|
|
|
/** @var \PHPUnit_Framework_MockObject_MockObject */ |
39
|
|
|
protected $consoleInput; |
40
|
|
|
/** @var \PHPUnit_Framework_MockObject_MockObject */ |
41
|
|
|
protected $consoleOutput; |
42
|
|
|
|
43
|
|
|
/** @var \Symfony\Component\Console\Command\Command */ |
44
|
|
|
protected $command; |
45
|
|
|
|
46
|
|
|
protected function setUp() { |
47
|
|
|
parent::setUp(); |
48
|
|
|
|
49
|
|
|
$userManager = $this->userManager = $this->getMockBuilder('OCP\IUserManager') |
50
|
|
|
->disableOriginalConstructor() |
51
|
|
|
->getMock(); |
52
|
|
|
$this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface'); |
53
|
|
|
$this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); |
54
|
|
|
|
55
|
|
|
$connection = \OC::$server->getDatabaseConnection(); |
56
|
|
|
$this->command = new DavProperties($userManager, $connection); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function testDatabaseFix() { |
60
|
|
|
// Check that the database is correctly adjusted |
61
|
|
|
$this->invokePrivate($this->command, 'output', [$this->consoleOutput]); |
62
|
|
|
$this->invokePrivate($this->command, 'fixDatabase'); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|