1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @author Christoph Wurst <[email protected]> |
5
|
|
|
* |
6
|
|
|
* ownCloud - Mail |
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 OCA\Mail\Tests\Service\Autoconfig; |
23
|
|
|
|
24
|
|
|
use OCA\Mail\Service\AutoConfig\IspDb; |
25
|
|
|
use PHPUnit_Framework_TestCase; |
26
|
|
|
|
27
|
|
|
class IspDbtest extends PHPUnit_Framework_TestCase { |
28
|
|
|
|
29
|
|
|
private $ispDb; |
30
|
|
|
|
31
|
|
|
protected function setUp() { |
32
|
|
|
parent::setUp(); |
33
|
|
|
|
34
|
|
|
$logger = $this->getMockBuilder('\OCA\Mail\Service\Logger') |
35
|
|
|
->disableOriginalConstructor() |
36
|
|
|
->getMock(); |
37
|
|
|
$this->ispDb = new IspDb($logger); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function queryData() { |
41
|
|
|
return [ |
42
|
|
|
['gmail.com'], |
43
|
|
|
['outlook.com'], |
44
|
|
|
['yahoo.de'], |
45
|
|
|
]; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @dataProvider queryData |
50
|
|
|
* |
51
|
|
|
* @param string $domain |
52
|
|
|
*/ |
53
|
|
|
public function testQueryGmail($domain) { |
54
|
|
|
$result = $this->ispDb->query($domain); |
55
|
|
|
|
56
|
|
|
$this->assertContainsIspData($result); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
private function assertContainsIspData($data) { |
60
|
|
|
$this->assertArrayHasKey('imap', $data); |
61
|
|
|
$this->assertTrue(count($data['imap']) >= 1, 'no isp imap data returned'); |
62
|
|
|
$this->assertArrayHasKey('smtp', $data); |
63
|
|
|
$this->assertTrue(count($data['smtp']) >= 1, 'no isp smtp data returned'); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
} |
67
|
|
|
|