Support symfony/console for 2.3 (LTS version); fixes #21

This commit is contained in:
Ben Ramsey
2014-02-19 20:20:49 -06:00
parent 4fa3a7abfd
commit 2ea4c90bd7
10 changed files with 97 additions and 35 deletions
+1 -1
View File
@@ -24,7 +24,7 @@
},
"require-dev": {
"moontoast/math": "~1.1",
"symfony/console": "~2.4",
"symfony/console": "~2.3",
"doctrine/dbal": ">=2.3",
"phpunit/phpunit": "~3.7"
},
@@ -56,7 +56,7 @@ class DecodeCommand extends Command
$uuid = Uuid::fromString($input->getArgument('uuid'));
$table = $this->getHelperSet()->get('table');
$table->setLayout(TableHelper::LAYOUT_COMPACT);
$table->setLayout(TableHelper::LAYOUT_BORDERLESS);
$table->addRows(array(
array('encode:', 'STR:', (string) $uuid),
@@ -2,9 +2,9 @@
namespace Rhumsaa\Uuid\Console\Command;
use Rhumsaa\Uuid\Console\Util\TestOutput;
use Rhumsaa\Uuid\Console\Util\BufferedOutput;
use Rhumsaa\Uuid\Uuid;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\BufferedOutput;
class DecodeCommandTest extends \PHPUnit_Framework_TestCase
{
@@ -0,0 +1,50 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Rhumsaa\Uuid\Console\Util;
use Symfony\Component\Console\Output\Output;
/**
* @author Jean-François Simon <contact@jfsimon.fr>
*/
class BufferedOutput extends Output
{
/**
* @var string
*/
private $buffer = '';
/**
* Empties buffer and returns its content.
*
* @return string
*/
public function fetch()
{
$content = $this->buffer;
$this->buffer = '';
return $content;
}
/**
* {@inheritdoc}
*/
protected function doWrite($message, $newline)
{
$this->buffer .= $message;
if ($newline) {
$this->buffer .= "\n";
}
}
}
@@ -1,3 +1,5 @@
encode: STR: ff6f8cb0-c57d-11e1-0b21-0800200c9a66
INT: 339532337419071774295426818102463863398
decode: variant: Not an RFC 4122 UUID
========= ========== =========================================
encode: STR: ff6f8cb0-c57d-11e1-0b21-0800200c9a66
INT: 339532337419071774295426818102463863398
decode: variant: Not an RFC 4122 UUID
========= ========== =========================================
@@ -1,7 +1,9 @@
encode: STR: 2ddbf60e-7fc4-11e3-a5ac-080027cd5e4d
INT: 60957363443838745229478843813485960781
decode: variant: RFC 4122
version: 1 (time and node based)
content: time: 2014-01-17T22:10:31+00:00
clock: 9644 (usually random)
node: 08:00:27:cd:5e:4d
========= ========== ========================================
encode: STR: 2ddbf60e-7fc4-11e3-a5ac-080027cd5e4d
INT: 60957363443838745229478843813485960781
decode: variant: RFC 4122
version: 1 (time and node based)
content: time: 2014-01-17T22:10:31+00:00
clock: 9644 (usually random)
node: 08:00:27:cd:5e:4d
========= ========== ========================================
@@ -1,4 +1,6 @@
encode: STR: 6fa459ea-ee8a-2ca4-894e-db77e160355e
INT: 148397667964594601879796619558430717278
decode: variant: RFC 4122
version: 2 (DCE security based)
========= ========== =========================================
encode: STR: 6fa459ea-ee8a-2ca4-894e-db77e160355e
INT: 148397667964594601879796619558430717278
decode: variant: RFC 4122
version: 2 (DCE security based)
========= ========== =========================================
@@ -1,6 +1,8 @@
encode: STR: 6fa459ea-ee8a-3ca4-894e-db77e160355e
INT: 148397667964594677437660345472754136414
decode: variant: RFC 4122
version: 3 (name based, MD5)
content: 6f:a4:59:ea:ee:8a:3c:a4:89:4e:db:77:e1:60:35:5e
(not decipherable: MD5 message digest only)
========= ========== =================================================
encode: STR: 6fa459ea-ee8a-3ca4-894e-db77e160355e
INT: 148397667964594677437660345472754136414
decode: variant: RFC 4122
version: 3 (name based, MD5)
content: 6f:a4:59:ea:ee:8a:3c:a4:89:4e:db:77:e1:60:35:5e
(not decipherable: MD5 message digest only)
========= ========== =================================================
@@ -1,6 +1,8 @@
encode: STR: 83fc61b6-b5ef-467f-9a15-89ddee668005
INT: 175439308125737940688973558970912768005
decode: variant: RFC 4122
version: 4 (random data based)
content: 83:fc:61:b6:b5:ef:46:7f:9a:15:89:dd:ee:66:80:05
(no semantics: random data only)
========= ========== =================================================
encode: STR: 83fc61b6-b5ef-467f-9a15-89ddee668005
INT: 175439308125737940688973558970912768005
decode: variant: RFC 4122
version: 4 (random data based)
content: 83:fc:61:b6:b5:ef:46:7f:9a:15:89:dd:ee:66:80:05
(no semantics: random data only)
========= ========== =================================================
@@ -1,6 +1,8 @@
encode: STR: 886313e1-3b8a-5372-9b90-0c9aee199e5d
INT: 181289448026289383154478846676280385117
decode: variant: RFC 4122
version: 5 (name based, SHA-1)
content: 88:63:13:e1:3b:8a:53:72:9b:90:0c:9a:ee:19:9e:5d
(not decipherable: MD5 message digest only)
========= ========== =================================================
encode: STR: 886313e1-3b8a-5372-9b90-0c9aee199e5d
INT: 181289448026289383154478846676280385117
decode: variant: RFC 4122
version: 5 (name based, SHA-1)
content: 88:63:13:e1:3b:8a:53:72:9b:90:0c:9a:ee:19:9e:5d
(not decipherable: MD5 message digest only)
========= ========== =================================================