5
5
use League \CLImate \Exceptions \InvalidArgumentException ;
6
6
use League \CLImate \Tests \TestBase ;
7
7
use League \CLImate \Util \Output ;
8
+ use League \CLImate \Util \Writer \Buffer ;
9
+ use League \CLImate \Util \Writer \StdErr ;
10
+ use League \CLImate \Util \Writer \StdOut ;
8
11
use Mockery ;
9
12
10
13
use function get_class ;
@@ -17,7 +20,7 @@ class OutputTest extends TestBase
17
20
*/
18
21
public function it_can_output_content ()
19
22
{
20
- $ out = Mockery::mock (' League\CLImate\Util\Writer\ StdOut' );
23
+ $ out = Mockery::mock (StdOut::class );
21
24
$ out ->shouldReceive ('write ' )->once ()->with ("Oh, hey there. " . \PHP_EOL );
22
25
23
26
$ output = new Output ();
@@ -33,7 +36,7 @@ public function it_can_output_content()
33
36
*/
34
37
public function it_can_output_content_without_a_new_line ()
35
38
{
36
- $ out = Mockery::mock (' League\CLImate\Util\Writer\ StdOut' );
39
+ $ out = Mockery::mock (StdOut::class );
37
40
$ out ->shouldReceive ('write ' )->once ()->with ("Oh, hey there. " );
38
41
39
42
$ output = new Output ();
@@ -49,7 +52,7 @@ public function it_can_output_content_without_a_new_line()
49
52
*/
50
53
public function it_can_default_to_a_writer ()
51
54
{
52
- $ error = Mockery::mock (' League\CLImate\Util\Writer\ StdErr' );
55
+ $ error = Mockery::mock (StdErr::class );
53
56
$ error ->shouldReceive ('write ' )->once ()->with ("Oh, hey there. " );
54
57
55
58
$ output = new Output ();
@@ -66,10 +69,10 @@ public function it_can_default_to_a_writer()
66
69
*/
67
70
public function it_can_default_to_multiple_writers ()
68
71
{
69
- $ out = Mockery::mock (' League\CLImate\Util\Writer\ StdOut' );
72
+ $ out = Mockery::mock (StdOut::class );
70
73
$ out ->shouldReceive ('write ' )->once ()->with ("Oh, hey there. " );
71
74
72
- $ error = Mockery::mock (' League\CLImate\Util\Writer\ StdErr' );
75
+ $ error = Mockery::mock (StdErr::class );
73
76
$ error ->shouldReceive ('write ' )->once ()->with ("Oh, hey there. " );
74
77
75
78
$ output = new Output ();
@@ -87,10 +90,10 @@ public function it_can_default_to_multiple_writers()
87
90
*/
88
91
public function it_can_add_a_default ()
89
92
{
90
- $ out = Mockery::mock (' League\CLImate\Util\Writer\ StdOut' );
93
+ $ out = Mockery::mock (StdOut::class );
91
94
$ out ->shouldReceive ('write ' )->once ()->with ("Oh, hey there. " );
92
95
93
- $ error = Mockery::mock (' League\CLImate\Util\Writer\ StdErr' );
96
+ $ error = Mockery::mock (StdErr::class );
94
97
$ error ->shouldReceive ('write ' )->once ()->with ("Oh, hey there. " );
95
98
96
99
$ output = new Output ();
@@ -109,10 +112,10 @@ public function it_can_add_a_default()
109
112
*/
110
113
public function it_can_handle_multiple_writers_for_one_key ()
111
114
{
112
- $ out = Mockery::mock (' League\CLImate\Util\Writer\ StdOut' );
115
+ $ out = Mockery::mock (StdOut::class );
113
116
$ out ->shouldReceive ('write ' )->once ()->with ('Oh, hey there. ' );
114
117
115
- $ error = Mockery::mock (' League\CLImate\Util\Writer\ StdErr' );
118
+ $ error = Mockery::mock (StdErr::class );
116
119
$ error ->shouldReceive ('write ' )->once ()->with ('Oh, hey there. ' );
117
120
118
121
$ output = new Output ();
@@ -129,10 +132,10 @@ public function it_can_handle_multiple_writers_for_one_key()
129
132
*/
130
133
public function it_can_take_existing_writer_keys_and_resolve_them ()
131
134
{
132
- $ out = Mockery::mock (' League\CLImate\Util\Writer\ StdOut' );
135
+ $ out = Mockery::mock (StdOut::class );
133
136
$ out ->shouldReceive ('write ' )->once ()->with ('Oh, hey there. ' );
134
137
135
- $ error = Mockery::mock (' League\CLImate\Util\Writer\ StdErr' );
138
+ $ error = Mockery::mock (StdErr::class );
136
139
$ error ->shouldReceive ('write ' )->once ()->with ('Oh, hey there. ' );
137
140
138
141
$ output = new Output ();
@@ -148,9 +151,9 @@ public function it_can_take_existing_writer_keys_and_resolve_them()
148
151
/** @test */
149
152
public function it_can_get_the_available_writers ()
150
153
{
151
- $ out = Mockery::mock (' League\CLImate\Util\Writer\ StdOut' );
152
- $ error = Mockery::mock (' League\CLImate\Util\Writer\ StdErr' );
153
- $ buffer = Mockery::mock (' League\CLImate\Util\Writer\ Buffer' );
154
+ $ out = Mockery::mock (StdOut::class );
155
+ $ error = Mockery::mock (StdErr::class );
156
+ $ buffer = Mockery::mock (Buffer::class );
154
157
155
158
$ output = new Output ();
156
159
@@ -185,7 +188,7 @@ public function it_can_get_the_available_writers()
185
188
/** @test */
186
189
public function it_will_yell_if_writer_does_not_implement_writer_interface ()
187
190
{
188
- $ out = Mockery::mock (' League\CLImate\Util\Writer\Wat ' );
191
+ $ out = Mockery::mock ();
189
192
$ output = new Output ();
190
193
191
194
$ this ->expectException (InvalidArgumentException::class);
@@ -211,10 +214,10 @@ public function it_will_yell_if_trying_to_add_a_non_existent_nested_writer_key()
211
214
*/
212
215
public function it_can_write_to_a_non_default_writer_once ()
213
216
{
214
- $ out = Mockery::mock (' League\CLImate\Util\Writer\ StdOut' );
217
+ $ out = Mockery::mock (StdOut::class );
215
218
$ out ->shouldReceive ('write ' )->once ()->with ('Second time. ' );
216
219
217
- $ error = Mockery::mock (' League\CLImate\Util\Writer\ StdErr' );
220
+ $ error = Mockery::mock (StdErr::class );
218
221
$ error ->shouldReceive ('write ' )->once ()->with ('First time. ' );
219
222
220
223
$ output = new Output ();
@@ -234,10 +237,10 @@ public function it_can_write_to_a_non_default_writer_once()
234
237
*/
235
238
public function it_will_persist_writer_if_told_to ()
236
239
{
237
- $ out = Mockery::mock (' League\CLImate\Util\Writer\ StdOut' );
240
+ $ out = Mockery::mock (StdOut::class );
238
241
$ out ->shouldReceive ('write ' )->once ()->with ('Second time. ' );
239
242
240
- $ error = Mockery::mock (' League\CLImate\Util\Writer\ StdErr' );
243
+ $ error = Mockery::mock (StdErr::class );
241
244
$ error ->shouldReceive ('write ' )->times (3 )->with ('First time. ' );
242
245
243
246
$ output = new Output ();
@@ -258,7 +261,7 @@ public function it_will_persist_writer_if_told_to()
258
261
/** @test */
259
262
public function it_can_retrieve_a_writer ()
260
263
{
261
- $ buffer = Mockery::mock (' League\CLImate\Util\Writer\ Buffer' );
264
+ $ buffer = Mockery::mock (Buffer::class );
262
265
$ buffer ->shouldReceive ('write ' )->once ()->with ('Oh, hey there. ' );
263
266
$ buffer ->shouldReceive ('get ' )->once ()->andReturn ('Oh, hey there. ' );
264
267
0 commit comments