Completed
Pull Request — master (#95)
by Kevin
02:45
created

AbstractAssertion   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 5
c 4
b 0
f 1
lcom 1
cbo 1
dl 0
loc 51
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setWebDriver() 0 4 1
A setLogger() 0 4 1
A setTestCase() 0 4 1
A getTestCase() 0 7 2
assert() 0 1 ?
1
<?php
2
3
namespace Magium\Assertions;
4
5
use Magium\AbstractTestCase;
6
use Magium\InvalidTestTypeException;
7
use Magium\TestCaseAware;
8
use Magium\Util\Log\Logger;
9
use Magium\Util\Log\LoggerAware;
10
use Magium\WebDriver\WebDriver;
11
use Magium\WebDriver\WebDriverAware;
12
13
abstract class AbstractAssertion implements LoggerAware, TestCaseAware, WebDriverAware
14
{
15
    /**
16
     * @var Logger
17
     */
18
19
    protected $logger;
20
21
    /**
22
     * @var \PHPUnit_Framework_TestCase
23
     */
24
25
    protected $testCase;
26
27
    /**
28
     * @var WebDriver
29
     */
30
31
    protected $webDriver;
32
33
    public function setWebDriver(WebDriver $webdriver)
34
    {
35
        $this->webDriver = $webdriver;
36
    }
37
38
    public function setLogger(Logger $logger)
39
    {
40
        $this->logger = $logger;
41
    }
42
43
    public function setTestCase(\PHPUnit_Framework_TestCase $testCase)
44
    {
45
        $this->testCase = $testCase;
46
    }
47
48
    /**
49
     * @return AbstractTestCase|\PHPUnit_Framework_TestCase
50
     * @throws InvalidTestTypeException
51
     */
52
53
    protected function getTestCase()
54
    {
55
        if (!$this->testCase instanceof AbstractTestCase) {
56
            throw new InvalidTestTypeException('Magium only understands instances of Magium\AbstractTestCase');
57
        }
58
        return $this->testCase;
59
    }
60
61
62
    abstract public function assert();
63
}