12 namespace Symfony\Component\Console\Tests\Helper;
26 $this->stream = fopen(
'php://memory',
'r+');
31 fclose($this->stream);
38 public function testRender($headers, $rows, $layout, $expected)
42 ->setHeaders($headers)
58 ->setHeaders($headers)
74 ->setHeaders($headers)
77 foreach ($rows as $row) {
88 array(
'99921-58-10-7',
'Divine Comedy',
'Dante Alighieri'),
89 array(
'9971-5-0210-0',
'A Tale of Two Cities',
'Charles Dickens'),
90 array(
'960-425-059-0',
'The Lord of the Rings',
'J. R. R. Tolkien'),
91 array(
'80-902734-1-6',
'And Then There Were None',
'Agatha Christie'),
96 array(
'ISBN',
'Title',
'Author'),
100 +---------------+--------------------------+------------------+
101 | ISBN | Title | Author |
102 +---------------+--------------------------+------------------+
103 | 99921-58-10-7 | Divine Comedy | Dante Alighieri |
104 | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
105 | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
106 | 80-902734-1-6 | And Then There Were None | Agatha Christie |
107 +---------------+--------------------------+------------------+
112 array(
'ISBN',
'Title',
'Author'),
117 99921-58-10-7 Divine Comedy Dante Alighieri
118 9971-5-0210-0 A Tale of Two Cities Charles Dickens
119 960-425-059-0 The Lord of the Rings J. R. R. Tolkien
120 80-902734-1-6 And Then There Were None Agatha Christie
125 array(
'ISBN',
'Title',
'Author'),
129 =============== ========================== ==================
131 =============== ========================== ==================
132 99921-58-10-7 Divine Comedy Dante Alighieri
133 9971-5-0210-0 A Tale of Two Cities Charles Dickens
134 960-425-059-0 The Lord of the Rings J. R. R. Tolkien
135 80-902734-1-6 And Then There Were None Agatha Christie
136 =============== ========================== ==================
141 array(
'ISBN',
'Title'),
143 array(
'99921-58-10-7',
'Divine Comedy',
'Dante Alighieri'),
144 array(
'9971-5-0210-0'),
145 array(
'960-425-059-0',
'The Lord of the Rings',
'J. R. R. Tolkien'),
146 array(
'80-902734-1-6',
'And Then There Were None',
'Agatha Christie'),
150 +---------------+--------------------------+------------------+
152 +---------------+--------------------------+------------------+
153 | 99921-58-10-7 | Divine Comedy | Dante Alighieri |
154 | 9971-5-0210-0 | | |
155 | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
156 | 80-902734-1-6 | And Then There Were None | Agatha Christie |
157 +---------------+--------------------------+------------------+
164 array(
'99921-58-10-7',
'Divine Comedy',
'Dante Alighieri'),
165 array(
'9971-5-0210-0'),
166 array(
'960-425-059-0',
'The Lord of the Rings',
'J. R. R. Tolkien'),
167 array(
'80-902734-1-6',
'And Then There Were None',
'Agatha Christie'),
171 +---------------+--------------------------+------------------+
172 | 99921-58-10-7 | Divine Comedy | Dante Alighieri |
173 | 9971-5-0210-0 | | |
174 | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
175 | 80-902734-1-6 | And Then There Were None | Agatha Christie |
176 +---------------+--------------------------+------------------+
181 array(
'ISBN',
'Title',
'Author'),
183 array(
'99921-58-10-7',
"Divine\nComedy",
'Dante Alighieri'),
184 array(
'9971-5-0210-2',
"Harry Potter\nand the Chamber of Secrets",
"Rowling\nJoanne K."),
185 array(
'9971-5-0210-2',
"Harry Potter\nand the Chamber of Secrets",
"Rowling\nJoanne K."),
186 array(
'960-425-059-0',
'The Lord of the Rings',
"J. R. R.\nTolkien"),
190 +---------------+----------------------------+-----------------+
191 | ISBN | Title | Author |
192 +---------------+----------------------------+-----------------+
193 | 99921-58-10-7 | Divine | Dante Alighieri |
195 | 9971-5-0210-2 | Harry Potter | Rowling |
196 | | and the Chamber of Secrets | Joanne K. |
197 | 9971-5-0210-2 | Harry Potter | Rowling |
198 | | and the Chamber of Secrets | Joanne K. |
199 | 960-425-059-0 | The Lord of the Rings | J. R. R. |
201 +---------------+----------------------------+-----------------+
206 array(
'ISBN',
'Title'),
222 'Cell text with tags used for Output styling' => array(
223 array(
'ISBN',
'Title',
'Author'),
225 array(
'<info>99921-58-10-7</info>',
'<error>Divine Comedy</error>',
'<fg=blue;bg=white>Dante Alighieri</fg=blue;bg=white>'),
226 array(
'9971-5-0210-0',
'A Tale of Two Cities',
'<info>Charles Dickens</>'),
230 +---------------+----------------------+-----------------+
231 | ISBN | Title | Author |
232 +---------------+----------------------+-----------------+
233 | 99921-58-10-7 | Divine Comedy | Dante Alighieri |
234 | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
235 +---------------+----------------------+-----------------+
239 'Cell text with tags not used for Output styling' => array(
240 array(
'ISBN',
'Title',
'Author'),
242 array(
'<strong>99921-58-10-700</strong>',
'<f>Divine Com</f>',
'Dante Alighieri'),
243 array(
'9971-5-0210-0',
'A Tale of Two Cities',
'Charles Dickens'),
247 +----------------------------------+----------------------+-----------------+
248 | ISBN | Title | Author |
249 +----------------------------------+----------------------+-----------------+
250 | <strong>99921-58-10-700</strong> | <f>Divine Com</f> | Dante Alighieri |
251 | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
252 +----------------------------------+----------------------+-----------------+
261 if (!function_exists(
'mb_strwidth')) {
262 $this->markTestSkipped(
'The "mbstring" extension is not available');
267 ->setHeaders(array(
'■■'))
268 ->setRows(array(array(1234)))
288 if (!function_exists(
'mb_strwidth')) {
289 $this->markTestSkipped(
'The "mbstring" extension is not available');
294 ->setHeaders(array(
'あいうえお'))
295 ->setRows(array(array(1234567890)))
322 return str_replace(PHP_EOL,
"\n", stream_get_contents($output->
getStream()));