Skip to content

Commit 3ef0969

Browse files
committed
Mock Terminal implementation for tests
1 parent 938ca67 commit 3ef0969

File tree

1 file changed

+195
-0
lines changed

1 file changed

+195
-0
lines changed

test/MockTerminal.php

+195
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpSchool\CliMenuTest;
6+
7+
use PhpSchool\Terminal\Terminal;
8+
9+
class MockTerminal implements Terminal
10+
{
11+
12+
/**
13+
* @inheritDoc
14+
*/
15+
public function getWidth(): int
16+
{
17+
return 100;
18+
}
19+
20+
/**
21+
* @inheritDoc
22+
*/
23+
public function getHeight(): int
24+
{
25+
return 30;
26+
}
27+
28+
/**
29+
* @inheritDoc
30+
*/
31+
public function getColourSupport(): int
32+
{
33+
return 8;
34+
}
35+
36+
/**
37+
* @inheritDoc
38+
*/
39+
public function disableEchoBack(): void
40+
{
41+
// noop
42+
}
43+
44+
/**
45+
* @inheritDoc
46+
*/
47+
public function enableEchoBack(): void
48+
{
49+
// noop
50+
}
51+
52+
/**
53+
* @inheritDoc
54+
*/
55+
public function isEchoBack(): bool
56+
{
57+
return false;
58+
}
59+
60+
/**
61+
* @inheritDoc
62+
*/
63+
public function disableCanonicalMode(): void
64+
{
65+
// noop
66+
}
67+
68+
/**
69+
* @inheritDoc
70+
*/
71+
public function enableCanonicalMode(): void
72+
{
73+
// noop
74+
}
75+
76+
/**
77+
* @inheritDoc
78+
*/
79+
public function isCanonicalMode(): bool
80+
{
81+
return true;
82+
}
83+
84+
/**
85+
* @inheritDoc
86+
*/
87+
public function isInteractive(): bool
88+
{
89+
return true;
90+
}
91+
92+
/**
93+
* @inheritDoc
94+
*/
95+
public function restoreOriginalConfiguration(): void
96+
{
97+
// noop
98+
}
99+
100+
/**
101+
* @inheritDoc
102+
*/
103+
public function supportsColour(): bool
104+
{
105+
return true;
106+
}
107+
108+
/**
109+
* @inheritDoc
110+
*/
111+
public function clear(): void
112+
{
113+
// noop
114+
}
115+
116+
/**
117+
* @inheritDoc
118+
*/
119+
public function clearLine(): void
120+
{
121+
//noop
122+
}
123+
124+
/**
125+
* @inheritDoc
126+
*/
127+
public function clearDown(): void
128+
{
129+
// noop
130+
}
131+
132+
/**
133+
* @inheritDoc
134+
*/
135+
public function clean(): void
136+
{
137+
// noop
138+
}
139+
140+
/**
141+
* @inheritDoc
142+
*/
143+
public function enableCursor(): void
144+
{
145+
// noop
146+
}
147+
148+
/**
149+
* @inheritDoc
150+
*/
151+
public function disableCursor(): void
152+
{
153+
// noop
154+
}
155+
156+
/**
157+
* @inheritDoc
158+
*/
159+
public function moveCursorToTop(): void
160+
{
161+
// noop
162+
}
163+
164+
/**
165+
* @inheritDoc
166+
*/
167+
public function moveCursorToRow(int $rowNumber): void
168+
{
169+
// noop
170+
}
171+
172+
/**
173+
* @inheritDoc
174+
*/
175+
public function moveCursorToColumn(int $columnNumber): void
176+
{
177+
// noop
178+
}
179+
180+
/**
181+
* @inheritDoc
182+
*/
183+
public function read(int $bytes): string
184+
{
185+
// noop
186+
}
187+
188+
/**
189+
* @inheritDoc
190+
*/
191+
public function write(string $buffer): void
192+
{
193+
// noop
194+
}
195+
}

0 commit comments

Comments
 (0)