1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the php-phantomjs. |
5
|
|
|
* |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
namespace JonnyW\PhantomJs\Tests\Unit\Procedure; |
10
|
|
|
|
11
|
|
|
use JonnyW\PhantomJs\Procedure\Output; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* PHP PhantomJs |
15
|
|
|
* |
16
|
|
|
* @author Jon Wenmoth <[email protected]> |
17
|
|
|
*/ |
18
|
|
|
class OutputTest extends \PHPUnit_Framework_TestCase |
19
|
|
|
{ |
20
|
|
|
|
21
|
|
|
/** +++++++++++++++++++++++++++++++++++ **/ |
22
|
|
|
/** ++++++++++++++ TESTS ++++++++++++++ **/ |
23
|
|
|
/** +++++++++++++++++++++++++++++++++++ **/ |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Test data storage. |
27
|
|
|
* |
28
|
|
|
* @access public |
29
|
|
|
* @return void |
30
|
|
|
*/ |
31
|
|
|
public function testDataStorage() |
32
|
|
|
{ |
33
|
|
|
$output = $this->getOutput(); |
34
|
|
|
$output->set('test', 'Test value'); |
35
|
|
|
|
36
|
|
|
$this->assertSame('Test value', $output->get('test')); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Test can import data. |
41
|
|
|
* |
42
|
|
|
* @access public |
43
|
|
|
* @return void |
44
|
|
|
*/ |
45
|
|
|
public function testCanImportData() |
46
|
|
|
{ |
47
|
|
|
$data = array( |
48
|
|
|
'test' => 'Test value', |
49
|
|
|
'test2' => 'Test value 2' |
50
|
|
|
); |
51
|
|
|
|
52
|
|
|
$output = $this->getOutput(); |
53
|
|
|
$output->import($data); |
54
|
|
|
|
55
|
|
|
$this->assertSame('Test value', $output->get('test')); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Test can log data. |
60
|
|
|
* |
61
|
|
|
* @access public |
62
|
|
|
* @return void |
63
|
|
|
*/ |
64
|
|
|
public function testCanLogData() |
65
|
|
|
{ |
66
|
|
|
$output = $this->getOutput(); |
67
|
|
|
$output->log('Test log'); |
68
|
|
|
|
69
|
|
|
$this->assertContains('Test log', $output->getLogs()); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** +++++++++++++++++++++++++++++++++++ **/ |
73
|
|
|
/** ++++++++++ TEST ENTITIES ++++++++++ **/ |
74
|
|
|
/** +++++++++++++++++++++++++++++++++++ **/ |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Get output. |
78
|
|
|
* |
79
|
|
|
* @access protected |
80
|
|
|
* @return \JonnyW\PhantomJs\Procedure\Output |
81
|
|
|
*/ |
82
|
|
|
protected function getOutput() |
83
|
|
|
{ |
84
|
|
|
$output = new Output(); |
85
|
|
|
|
86
|
|
|
return $output; |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|