Completed
Pull Request — master (#1638)
by Thomas
06:26
created

LoggerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 36
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * @author Christoph Wurst <[email protected]>
5
 * @author Thomas Müller <[email protected]>
6
 *
7
 * Mail
8
 *
9
 * This code is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License, version 3,
11
 * as published by the Free Software Foundation.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU Affero General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public License, version 3,
19
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
20
 *
21
 */
22
23
namespace OCA\Mail\Tests\Service;
24
25
use Exception;
26
use OCA\Mail\Service\Logger;
27
use Test\TestCase;
28
29
class LoggerTest extends TestCase {
30
31
	/**
32
	 * @dataProvider providesLoggerMethods
33
	 * @param $method
34
	 */
35
	public function testLoggerMethod($method, $param = '1') {
36
37
		$baseLogger = $this->getMock('\OCP\ILogger');
38
		$baseLogger->expects($this->once())
39
			->method($method)
40
			->with(
41
				$this->equalTo($param), $this->equalTo([
42
					'app' => 'mail',
43
					'key' => 'value',
44
		]));
45
46
		$logger = new Logger('mail', $baseLogger);
47
		$logger->$method($param, ['key' => 'value']);
48
	}
49
50
	public function providesLoggerMethods() {
51
		return [
52
			['alert'],
53
			['warning'],
54
			['emergency'],
55
			['critical'],
56
			['error'],
57
			['notice'],
58
			['info'],
59
			['debug'],
60
			['logException', new Exception()],
61
		];
62
	}
63
64
}
65