Completed
Push — master ( de9e2d...f59dfb )
by Henry
08:37
created

TestCaseAbstract::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Redaxscript\Tests;
3
4
use Facebook\WebDriver\Chrome\ChromeOptions;
5
use Facebook\WebDriver\Remote\DesiredCapabilities;
6
use Facebook\WebDriver\Remote\RemoteWebDriver;
7
use PHPUnitProviderAutoloader;
8
use Redaxscript\Config;
9
use Redaxscript\Db;
10
use Redaxscript\Language;
11
use Redaxscript\Registry;
12
use Redaxscript\Request;
13
14
/**
15
 * TestCaseAbstract
16
 *
17
 * @since 2.2.0
18
 *
19
 * @package Redaxscript
20
 * @category Tests
21
 * @author Henry Ruhs
22
 */
23
24
abstract class TestCaseAbstract extends PHPUnitProviderAutoloader\TestCaseAbstract
25
{
26
	/**
27
	 * instance of the registry class
28
	 *
29
	 * @var Registry
30
	 */
31
32
	protected $_registry;
33
34
	/**
35
	 * instance of the request class
36
	 *
37
	 * @var Request
38
	 */
39
40
	protected $_request;
41
42
	/**
43
	 * instance of the language class
44
	 *
45
	 * @var Language
46
	 */
47
48
	protected $_language;
49
50
	/**
51
	 * instance of the config class
52
	 *
53
	 * @var Config
54
	 */
55
56
	protected $_config;
57
58
	/**
59
	 * instance of the driver class
60
	 *
61
	 * @var RemoteWebDriver
62
	 */
63
64
	protected $_driver;
65
66
	/**
67
	 * namespace of the testing suite
68
	 *
69
	 * @var string
70
	 */
71
72
	protected $_testNamespace = __NAMESPACE__;
73
74
	/**
75
	 * setUp
76
	 *
77
	 * @since 3.1.0
78
	 */
79
80
	public function setUp()
81
	{
82
		Db::clearCache();
83
		$options = new ChromeOptions();
84
		$options->addArguments(
85
		[
86
			'start-fullscreen'
87
		]);
88
		$capabilities = DesiredCapabilities::chrome();
89
		$capabilities->setCapability(ChromeOptions::CAPABILITY, $options);
90
		$this->_registry = Registry::getInstance();
91
		$this->_request = Request::getInstance();
92
		$this->_language = Language::getInstance();
93
		$this->_config = Config::getInstance();
94
		$this->_driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities);
95
		$this->_driver->get('http://localhost:8000');
96
	}
97
98
	/**
99
	 * tearDown
100
	 *
101
	 * @since 4.0.0
102
	 */
103
104
	public function tearDown()
105
	{
106
		$this->_driver->quit();
107
	}
108
}
109