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

AbstractAssertion::setWebDriver()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
nc 1
cc 1
eloc 2
nop 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
}