StartConvTest::setUp()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 31
rs 8.8571
cc 1
eloc 24
nc 1
nop 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 19 and the first side effect is on line 10.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * Copyright (c) 2014, Tobia De Koninck hey--at--ledfan.be
4
 * This file is licensed under the AGPL version 3 or later.
5
 * See the COPYING file.
6
 */
7
8
namespace OCA\Chat\OCH\Commands;
9
10
include_once(__DIR__ . '/../../../autoloader.php');
11
include_once(__DIR__ . '/../../../vendor/Pimple/Pimple.php');
12
13
14
use OCA\Chat\Core\API;
15
use OCA\Chat\OCH\Commands\StartConv;
16
use OCA\Chat\App\Chat;
17
use \OCA\Chat\OCH\Db\UserOnline;
18
19
class StartConvTest extends \PHPUnit_Framework_TestCase {
20
21
22
	public function setUp(){
23
		$app =  new Chat();
0 ignored issues
show
Bug introduced by
The call to Chat::__construct() misses some required arguments starting with $backendManager.
Loading history...
24
		$this->container = $app->getContainer();
0 ignored issues
show
Bug introduced by
The property container does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Bug introduced by
The method getContainer() does not seem to exist on object<OCA\Chat\App\Chat>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
		$this->container['ConversationMapper'] = $this->getMockBuilder('\OCA\Chat\OCH\Db\ConversationMapper')
26
			->disableOriginalConstructor()
27
			->getMock();
28
29
		$this->container['UserOnlineMapper'] = $this->getMockBuilder('\OCA\Chat\OCH\Db\UserOnlineMapper')
30
			->disableOriginalConstructor()
31
			->getMock();
32
33
		$this->container['PushMessageMapper'] = $this->getMockBuilder('\OCA\Chat\OCH\Db\PushMessageMapper')
34
			->disableOriginalConstructor()
35
			->getMock();
36
37
		$this->container['UserMapper'] = $this->getMockBuilder('\OCA\Chat\OCH\Db\UserMapper')
38
			->disableOriginalConstructor()
39
			->getMock();
40
41
		$this->container['API'] = $this->getMockBuilder('\OCA\Chat\Core\API')
42
			->disableOriginalConstructor()
43
			->getMock();
44
45
		$this->container['InitConvMapper'] = $this->getMockBuilder('\OCA\Chat\OCH\Db\InitConvMapper')
46
			->disableOriginalConstructor()
47
			->getMock();
48
		
49
		$this->container['API']->expects($this->any())
50
			->method('log')
51
			->will($this->returnValue(null));
52
	}
53
54
	public function testConversationExistsDBError(){
55
56
	}
57
58
59
	public function testConversationExists(){
60
	}
61
62
}
63