Code Duplication    Length = 26-27 lines in 2 locations

tests/php/controller/OtoLayerControllerTest.php 1 location

@@ 24-49 (lines=26) @@
21
	 * @param IUserSession $userSession
22
	 */
23
24
	public function setUp() {
25
		$this->appName = 'calendar';
26
		$this->request = $this->getMockBuilder('\OCP\IRequest')
27
			->disableOriginalConstructor()
28
			->getMock();
29
		$this->mapper = $this->getMockBuilder('\OCP\OtoLayerMapper')
30
			->disableOriginalConstructor()
31
			->getMock();
32
		$this->userSession = $this->getMockBuilder('OCP\IUserSession')
33
			->disableOriginalConstructor()
34
			->getMock();
35
		$this->dummyUser = $this->getMockBuilder('OCP\IUser')
36
			->disableOriginalConstructor()
37
			->getMock();
38
39
		$this->userSession->expects($this->once())
40
			->method('getUser')
41
			->will($this->returnValue($this->dummyUser));
42
43
		$this->dummyUser->expects($this->once())
44
			->method('getUID')
45
			->will($this->returnValue('user123'));
46
47
		$this->controller = new OtoLayerController($this->appName,
48
			$this->mapper, $this->request, $this->userSession);
49
    }
50
    
51
52

tests/php/controller/settingscontrollerTest.php 1 location

@@ 35-61 (lines=27) @@
32
33
	private $controller;
34
35
	public function setUp() {
36
		$this->appName = 'calendar';
37
		$this->request = $this->getMockBuilder('\OCP\IRequest')
38
			->disableOriginalConstructor()
39
			->getMock();
40
		$this->userSession = $this->getMockBuilder('OCP\IUserSession')
41
			->disableOriginalConstructor()
42
			->getMock();
43
		$this->config = $this->getMockBuilder('OCP\IConfig')
44
			->disableOriginalConstructor()
45
			->getMock();
46
47
		$this->dummyUser = $this->getMockBuilder('OCP\IUser')
48
			->disableOriginalConstructor()
49
			->getMock();
50
51
		$this->userSession->expects($this->once())
52
			->method('getUser')
53
			->will($this->returnValue($this->dummyUser));
54
55
		$this->dummyUser->expects($this->once())
56
			->method('getUID')
57
			->will($this->returnValue('user123'));
58
59
		$this->controller = new SettingsController($this->appName,
60
			$this->request, $this->userSession, $this->config);
61
	}
62
63
	/**
64
	 * @dataProvider setViewWithAllowedViewDataProvider