Tests the cli.
More...
Tests the cli.
Warning: these tests are very rudimentary.
Definition at line 12 of file CliTest.php.
◆ setUp()
Sabre\VObject\CliTest::setUp |
( |
| ) |
|
Definition at line 14 of file CliTest.php.
16 $this->cli =
new CliMock();
17 $this->cli->stderr =
fopen(
'php://memory',
'r+');
18 $this->cli->stdout =
fopen(
'php://memory',
'r+');
◆ testColorCalendar()
Sabre\VObject\CliTest::testColorCalendar |
( |
| ) |
|
Note: this is a very shallow test, doesn't dig into the actual output, but just makes sure there's no errors thrown.
The colorizer is not a critical component, it's mostly a debugging tool.
This object is not valid, but it's designed to hit every part of the colorizer source.
Definition at line 542 of file CliTest.php.
544 $inputStream =
fopen(
'php://memory',
'r+');
552 fwrite($inputStream, <<<VCARD
559 ATTENDEE;RSVP=TRUE:mailto:foo@example.org
567 rewind($inputStream);
568 $this->cli->stdin = $inputStream;
570 $result = $this->cli->main([
'vobject',
'color',
'-']);
572 rewind($this->cli->stderr);
573 $error = stream_get_contents($this->cli->stderr);
578 "This should have been error free. stderr output:\n" . $error
const VERSION
Full version number.
◆ testColorVCard()
Sabre\VObject\CliTest::testColorVCard |
( |
| ) |
|
Note: this is a very shallow test, doesn't dig into the actual output, but just makes sure there's no errors thrown.
The colorizer is not a critical component, it's mostly a debugging tool.
This object is not valid, but it's designed to hit every part of the colorizer source.
Definition at line 589 of file CliTest.php.
591 $inputStream =
fopen(
'php://memory',
'r+');
599 fwrite($inputStream, <<<VCARD
609 rewind($inputStream);
610 $this->cli->stdin = $inputStream;
612 $result = $this->cli->main([
'vobject',
'color',
'-']);
614 rewind($this->cli->stderr);
615 $error = stream_get_contents($this->cli->stderr);
620 "This should have been error free. stderr output:\n" . $error
const VERSION
Full version number.
◆ testConvertDefaultFormats()
Sabre\VObject\CliTest::testConvertDefaultFormats |
( |
| ) |
|
Definition at line 282 of file CliTest.php.
288 $this->cli->main([
'vobject',
'convert',
'foo.json',
$outputFile])
291 $this->assertEquals(
'json', $this->cli->inputFormat);
292 $this->assertEquals(
'json', $this->cli->format);
◆ testConvertDefaultFormats2()
Sabre\VObject\CliTest::testConvertDefaultFormats2 |
( |
| ) |
|
Definition at line 296 of file CliTest.php.
302 $this->cli->main([
'vobject',
'convert',
'foo.ics',
$outputFile])
305 $this->assertEquals(
'mimedir', $this->cli->inputFormat);
306 $this->assertEquals(
'mimedir', $this->cli->format);
◆ testConvertJCalFail()
Sabre\VObject\CliTest::testConvertJCalFail |
( |
| ) |
|
Definition at line 200 of file CliTest.php.
202 $inputStream =
fopen(
'php://memory',
'r+');
204 fwrite($inputStream, <<<ICS
211 rewind($inputStream);
212 $this->cli->stdin = $inputStream;
216 $this->cli->main([
'vobject',
'convert',
'--format=jcal',
'--inputformat=mimedir',
'-'])
◆ testConvertJCardPretty()
Sabre\VObject\CliTest::testConvertJCardPretty |
( |
| ) |
|
Definition at line 158 of file CliTest.php.
160 if (version_compare(PHP_VERSION,
'5.4.0') < 0) {
161 $this->markTestSkipped(
'This test required PHP 5.4.0');
164 $inputStream =
fopen(
'php://memory',
'r+');
166 fwrite($inputStream, <<<ICS
173 rewind($inputStream);
174 $this->cli->stdin = $inputStream;
178 $this->cli->main([
'vobject',
'convert',
'--format=jcard',
'--pretty',
'-'])
181 rewind($this->cli->stdout);
193 $this->assertStringStartsWith( 195 stream_get_contents($this->cli->stdout)
◆ testConvertJson()
Sabre\VObject\CliTest::testConvertJson |
( |
| ) |
|
Definition at line 130 of file CliTest.php.
References $version, and Sabre\VObject\Version\VERSION.
132 $inputStream =
fopen(
'php://memory',
'r+');
134 fwrite($inputStream, <<<ICS
141 rewind($inputStream);
142 $this->cli->stdin = $inputStream;
146 $this->cli->main([
'vobject',
'convert',
'--format=json',
'-'])
149 rewind($this->cli->stdout);
152 '["vcard",[["version",{},"text","4.0"],["prodid",{},"text","-\/\/Sabre\/\/Sabre VObject ' .
$version .
'\/\/EN"],["fn",{},"text","Cowboy Henk"]]]',
153 stream_get_contents($this->cli->stdout)
const VERSION
Full version number.
◆ testConvertMimeDir()
Sabre\VObject\CliTest::testConvertMimeDir |
( |
| ) |
|
Definition at line 221 of file CliTest.php.
223 $inputStream =
fopen(
'php://memory',
'r+');
225 fwrite($inputStream, <<<JCARD
243 "-\/\/Sabre\/\/Sabre VObject 3.1.0\/\/EN" 257 rewind($inputStream);
258 $this->cli->stdin = $inputStream;
262 $this->cli->main([
'vobject',
'convert',
'--format=mimedir',
'--inputformat=json',
'--pretty',
'-'])
265 rewind($this->cli->stdout);
276 strtr($expected, [
"\n" =>
"\r\n"]),
277 stream_get_contents($this->cli->stdout)
◆ testFormat()
Sabre\VObject\CliTest::testFormat |
( |
| ) |
|
Definition at line 57 of file CliTest.php.
61 $this->cli->main([
'vobject',
'--format=jcard'])
64 rewind($this->cli->stderr);
65 $this->assertTrue(strlen(stream_get_contents($this->cli->stderr)) > 100);
67 $this->assertEquals(
'jcard', $this->cli->format);
◆ testFormatInvalid()
Sabre\VObject\CliTest::testFormatInvalid |
( |
| ) |
|
Definition at line 71 of file CliTest.php.
75 $this->cli->main([
'vobject',
'--format=foo'])
78 rewind($this->cli->stderr);
79 $this->assertTrue(strlen(stream_get_contents($this->cli->stderr)) > 100);
81 $this->assertNull($this->cli->format);
◆ testHelp()
Sabre\VObject\CliTest::testHelp |
( |
| ) |
|
Definition at line 46 of file CliTest.php.
50 $this->cli->main([
'vobject',
'-h'])
52 rewind($this->cli->stderr);
53 $this->assertTrue(strlen(stream_get_contents($this->cli->stderr)) > 100);
◆ testInputFormatInvalid()
Sabre\VObject\CliTest::testInputFormatInvalid |
( |
| ) |
|
Definition at line 85 of file CliTest.php.
89 $this->cli->main([
'vobject',
'--inputformat=foo'])
92 rewind($this->cli->stderr);
93 $this->assertTrue(strlen(stream_get_contents($this->cli->stderr)) > 100);
95 $this->assertNull($this->cli->format);
◆ testInvalidArg()
Sabre\VObject\CliTest::testInvalidArg |
( |
| ) |
|
Definition at line 22 of file CliTest.php.
26 $this->cli->main([
'vobject',
'--hi'])
28 rewind($this->cli->stderr);
29 $this->assertTrue(strlen(stream_get_contents($this->cli->stderr)) > 100);
◆ testNoInputFile()
Sabre\VObject\CliTest::testNoInputFile |
( |
| ) |
|
Definition at line 100 of file CliTest.php.
104 $this->cli->main([
'vobject',
'color'])
107 rewind($this->cli->stderr);
108 $this->assertTrue(strlen(stream_get_contents($this->cli->stderr)) > 100);
◆ testQuiet()
Sabre\VObject\CliTest::testQuiet |
( |
| ) |
|
Definition at line 33 of file CliTest.php.
37 $this->cli->main([
'vobject',
'-q'])
39 $this->assertTrue($this->cli->quiet);
41 rewind($this->cli->stderr);
42 $this->assertEquals(0, strlen(stream_get_contents($this->cli->stderr)));
◆ testRepair()
Sabre\VObject\CliTest::testRepair |
( |
| ) |
|
Definition at line 480 of file CliTest.php.
482 $inputStream =
fopen(
'php://memory',
'r+');
484 fwrite($inputStream, <<<VCARD
491 rewind($inputStream);
492 $this->cli->stdin = $inputStream;
496 $this->cli->main([
'vobject',
'repair',
'-'])
499 rewind($this->cli->stdout);
500 $this->assertRegExp(
"/^BEGIN:VCARD\r\nVERSION:2.1\r\nUID:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\r\nEND:VCARD\r\n$/", stream_get_contents($this->cli->stdout));
◆ testRepairNothing()
Sabre\VObject\CliTest::testRepairNothing |
( |
| ) |
|
Definition at line 503 of file CliTest.php.
505 $inputStream =
fopen(
'php://memory',
'r+');
507 fwrite($inputStream, <<<VCARD
513 DTSTAMP:20140122T233226Z
514 DTSTART:20140101T120000Z
520 rewind($inputStream);
521 $this->cli->stdin = $inputStream;
523 $result = $this->cli->main([
'vobject',
'repair',
'-']);
525 rewind($this->cli->stderr);
526 $error = stream_get_contents($this->cli->stderr);
531 "This should have been error free. stderr output:\n" . $error
◆ testTooManyArgs()
Sabre\VObject\CliTest::testTooManyArgs |
( |
| ) |
|
Definition at line 112 of file CliTest.php.
116 $this->cli->main([
'vobject',
'color',
'a',
'b',
'c'])
◆ testUnknownCommand()
Sabre\VObject\CliTest::testUnknownCommand |
( |
| ) |
|
Definition at line 121 of file CliTest.php.
125 $this->cli->main([
'vobject',
'foo',
'-'])
◆ testValidate()
Sabre\VObject\CliTest::testValidate |
( |
| ) |
|
Definition at line 413 of file CliTest.php.
415 $inputStream =
fopen(
'php://memory',
'r+');
417 fwrite($inputStream, <<<VCARD
427 rewind($inputStream);
428 $this->cli->stdin = $inputStream;
429 $result = $this->cli->main([
'vobject',
'validate',
'-']);
◆ testValidateFail()
Sabre\VObject\CliTest::testValidateFail |
( |
| ) |
|
Definition at line 438 of file CliTest.php.
440 $inputStream =
fopen(
'php://memory',
'r+');
442 fwrite($inputStream, <<<VCARD
449 rewind($inputStream);
450 $this->cli->stdin = $inputStream;
454 $this->cli->main([
'vobject',
'validate',
'-'])
◆ testValidateFail2()
Sabre\VObject\CliTest::testValidateFail2 |
( |
| ) |
|
Definition at line 459 of file CliTest.php.
461 $inputStream =
fopen(
'php://memory',
'r+');
463 fwrite($inputStream, <<<VCARD
470 rewind($inputStream);
471 $this->cli->stdin = $inputStream;
475 $this->cli->main([
'vobject',
'validate',
'-'])
◆ testVCard3040()
Sabre\VObject\CliTest::testVCard3040 |
( |
| ) |
|
Definition at line 310 of file CliTest.php.
312 $inputStream =
fopen(
'php://memory',
'r+');
314 fwrite($inputStream, <<<VCARD
323 rewind($inputStream);
324 $this->cli->stdin = $inputStream;
328 $this->cli->main([
'vobject',
'convert',
'--format=vcard40',
'--pretty',
'-'])
331 rewind($this->cli->stdout);
344 strtr($expected, [
"\n" =>
"\r\n"]),
345 stream_get_contents($this->cli->stdout)
const VERSION
Full version number.
◆ testVCard4021()
Sabre\VObject\CliTest::testVCard4021 |
( |
| ) |
|
Definition at line 390 of file CliTest.php.
392 $inputStream =
fopen(
'php://memory',
'r+');
394 fwrite($inputStream, <<<VCARD
403 rewind($inputStream);
404 $this->cli->stdin = $inputStream;
408 $this->cli->main([
'vobject',
'convert',
'--format=vcard21',
'--pretty',
'-'])
◆ testVCard4030()
Sabre\VObject\CliTest::testVCard4030 |
( |
| ) |
|
Definition at line 350 of file CliTest.php.
352 $inputStream =
fopen(
'php://memory',
'r+');
354 fwrite($inputStream, <<<VCARD
363 rewind($inputStream);
364 $this->cli->stdin = $inputStream;
368 $this->cli->main([
'vobject',
'convert',
'--format=vcard30',
'--pretty',
'-'])
373 rewind($this->cli->stdout);
384 strtr($expected, [
"\n" =>
"\r\n"]),
385 stream_get_contents($this->cli->stdout)
const VERSION
Full version number.
The documentation for this class was generated from the following file:
- libs/composer/vendor/sabre/vobject/tests/VObject/CliTest.php