Add pear modules, mail and net_smtp via composer (#93)
Add pear modules, mail and net_smtp via composer, remove php 5.6 build due to phpunit 6
This commit is contained in:
@@ -18,7 +18,7 @@ class APIDocsTests extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
$testDocs = tempnam(sys_get_temp_dir(), 'TestAPIDocs.md');
|
||||
$currentDocs = getcwd() . '/docs/Api.md';
|
||||
$currentDocs = getcwd() . '/docs/api.md';
|
||||
passthru("vendor/bin/phpdoc-md generate src > $testDocs");
|
||||
|
||||
$testDocsContent = file_get_contents($testDocs);
|
||||
@@ -27,6 +27,6 @@ class APIDocsTests extends \PHPUnit_Framework_TestCase
|
||||
$testDocsContent = str_replace (array("\r\n", "\r"), "\n", $testDocsContent);
|
||||
$currentDocsContent = str_replace (array("\r\n", "\r"), "\n", $currentDocsContent);
|
||||
|
||||
$this->assertEquals($testDocsContent, $currentDocsContent, "API docuementation out of date. Run 'composer Api' to update.");
|
||||
$this->assertEquals($testDocsContent, $currentDocsContent, "API docuementation out of date. Run 'composer api' to update.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use Consolidation\OutputFormatters\Options\FormatterOptions;
|
||||
use Consolidation\OutputFormatters\StructuredData\AssociativeList;
|
||||
use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
|
||||
use Consolidation\OutputFormatters\StructuredData\PropertyList;
|
||||
use Consolidation\OutputFormatters\StructuredData\ListDataFromKeys;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
@@ -47,8 +48,31 @@ one: a
|
||||
two: b
|
||||
three: c
|
||||
EOT;
|
||||
|
||||
$this->assertFormattedOutputMatches($expected, 'yaml', $data);
|
||||
|
||||
$expected = <<<EOT
|
||||
a
|
||||
b
|
||||
c
|
||||
EOT;
|
||||
$this->assertFormattedOutputMatches($expected, 'list', $data);
|
||||
|
||||
$data = new ListDataFromKeys($data);
|
||||
|
||||
$expected = <<<EOT
|
||||
one: a
|
||||
two: b
|
||||
three: c
|
||||
EOT;
|
||||
$this->assertFormattedOutputMatches($expected, 'yaml', $data);
|
||||
|
||||
$expected = <<<EOT
|
||||
one
|
||||
two
|
||||
three
|
||||
EOT;
|
||||
|
||||
$this->assertFormattedOutputMatches($expected, 'list', $data);
|
||||
}
|
||||
|
||||
function testNestedYaml()
|
||||
@@ -527,7 +551,6 @@ EOT;
|
||||
function testTableWithWordWrapping()
|
||||
{
|
||||
$options = new FormatterOptions();
|
||||
$options->setWidth(42);
|
||||
|
||||
$data = [
|
||||
[
|
||||
@@ -538,19 +561,191 @@ EOT;
|
||||
$data = new RowsOfFields($data);
|
||||
|
||||
$expected = <<<EOT
|
||||
------------------- --------------------
|
||||
First Second
|
||||
------------------- --------------------
|
||||
This is a really This is the second
|
||||
long cell that column of the same
|
||||
contains a lot of table. It is also
|
||||
data. When it is very long, and
|
||||
rendered, it should be wrapped
|
||||
should be wrapped across multiple
|
||||
across multiple lines, just like
|
||||
lines. the first column.
|
||||
------------------- --------------------
|
||||
------------------ --------------------
|
||||
First Second
|
||||
------------------ --------------------
|
||||
This is a really This is the second
|
||||
long cell that column of the same
|
||||
contains a lot table. It is also
|
||||
of data. When it very long, and
|
||||
is rendered, it should be wrapped
|
||||
should be across multiple
|
||||
wrapped across lines, just like
|
||||
multiple lines. the first column.
|
||||
------------------ --------------------
|
||||
EOT;
|
||||
$options->setWidth(42);
|
||||
$this->assertFormattedOutputMatches($expected, 'table', $data, $options);
|
||||
|
||||
$expected = <<<EOT
|
||||
----------------------------------- ---------------------------------------
|
||||
First Second
|
||||
----------------------------------- ---------------------------------------
|
||||
This is a really long cell that This is the second column of the same
|
||||
contains a lot of data. When it table. It is also very long, and
|
||||
is rendered, it should be wrapped should be wrapped across multiple
|
||||
across multiple lines. lines, just like the first column.
|
||||
----------------------------------- ---------------------------------------
|
||||
EOT;
|
||||
$options->setWidth(78);
|
||||
$this->assertFormattedOutputMatches($expected, 'table', $data, $options);
|
||||
}
|
||||
|
||||
function testWrappingLotsOfColumns()
|
||||
{
|
||||
$options = new FormatterOptions();
|
||||
|
||||
$data = [
|
||||
[
|
||||
'id' => '4d87b545-b4c3-4ece-9908-20c5c5e67e81',
|
||||
'name' => '123456781234567812345678123456781234567812345678',
|
||||
'service_level' => 'business',
|
||||
'framework' => 'wordpress-network',
|
||||
'owner' => '8558a08d-8059-45f6-9c4b-908299a025ee',
|
||||
'created' => '2017-05-24 19:28:45',
|
||||
'memberships' => 'b3a42ba5-755d-42ca-9109-21bde32809d0: Team,9bfaaf50-ece3-4460-acb8-dc1b8dd536e8: pantheon-engineering-canary-sites',
|
||||
'frozen' => 'false',
|
||||
],
|
||||
[
|
||||
'id' => '3d87b545-b4c3-4ece-9908-20c5c5e67e80',
|
||||
'name' => 'build-tools-136',
|
||||
'service_level' => 'free',
|
||||
'framework' => 'drupal8',
|
||||
'owner' => '7558a08d-8059-45f6-9c4b-908299a025ef',
|
||||
'created' => '2017-05-24 19:28:45',
|
||||
'memberships' => '5ae1fa30-8cc4-4894-8ca9-d50628dcba17: ci-for-drupal-8-composer',
|
||||
'frozen' => 'false',
|
||||
]
|
||||
];
|
||||
$data = new RowsOfFields($data);
|
||||
|
||||
$expected = <<<EOT
|
||||
------------- ---------------- --------------- ----------- ------------- --------- ------------------------------------ --------
|
||||
Id Name Service_level Framework Owner Created Memberships Frozen
|
||||
------------- ---------------- --------------- ----------- ------------- --------- ------------------------------------ --------
|
||||
4d87b545-b4 12345678123456 business wordp 8558a08d-80 2017-0 b3a42ba5-755d-42ca-9109-21bde32809 false
|
||||
c3-4ece-990 78123456781234 ress- 59-45f6-9c4 5-24 d0:
|
||||
8-20c5c5e67 56781234567812 netwo b-908299a02 19:28: Team,9bfaaf50-ece3-4460-acb8-dc1b8
|
||||
e81 345678 rk 5ee 45 dd536e8:
|
||||
pantheon-engineering-canary-sites
|
||||
3d87b545-b4 build-tools-13 free drupa 7558a08d-80 2017-0 5ae1fa30-8cc4-4894-8ca9-d50628dcba false
|
||||
c3-4ece-990 6 l8 59-45f6-9c4 5-24 17: ci-for-drupal-8-composer
|
||||
8-20c5c5e67 b-908299a02 19:28:
|
||||
e80 5ef 45
|
||||
------------- ---------------- --------------- ----------- ------------- --------- ------------------------------------ --------
|
||||
EOT;
|
||||
|
||||
$options->setWidth(125);
|
||||
$this->assertFormattedOutputMatches($expected, 'table', $data, $options);
|
||||
}
|
||||
|
||||
function testTableWithWordWrapping2()
|
||||
{
|
||||
$options = new FormatterOptions();
|
||||
|
||||
$data = [
|
||||
[
|
||||
'id' => 42,
|
||||
'vid' => 321,
|
||||
'description' => 'Life, the Universe and Everything.',
|
||||
],
|
||||
[
|
||||
'id' => 13,
|
||||
'vid' => 789,
|
||||
'description' => 'Why is six afraid of seven?',
|
||||
],
|
||||
];
|
||||
$data = new RowsOfFields($data);
|
||||
$expected = <<<EOT
|
||||
---- ----- -----------------------------
|
||||
Id Vid Description
|
||||
---- ----- -----------------------------
|
||||
42 321 Life, the Universe and
|
||||
Everything.
|
||||
13 789 Why is six afraid of seven?
|
||||
---- ----- -----------------------------
|
||||
EOT;
|
||||
$options->setWidth(42);
|
||||
$this->assertFormattedOutputMatches($expected, 'table', $data, $options);
|
||||
}
|
||||
|
||||
function testTableWithWordWrapping3()
|
||||
{
|
||||
$options = new FormatterOptions();
|
||||
$data = [
|
||||
'name' => 'Rex',
|
||||
'species' => 'dog',
|
||||
'food' => 'kibble',
|
||||
'legs' => '4',
|
||||
'description' => 'Rex is a very good dog, Brett. He likes kibble, and has four legs.',
|
||||
];
|
||||
$data = new PropertyList($data);
|
||||
|
||||
$expected = <<<EOT
|
||||
------------- -------------------------
|
||||
Name Rex
|
||||
Species dog
|
||||
Food kibble
|
||||
Legs 4
|
||||
Description Rex is a very good dog,
|
||||
Brett. He likes kibble,
|
||||
and has four legs.
|
||||
------------- -------------------------
|
||||
EOT;
|
||||
$options->setWidth(42);
|
||||
$this->assertFormattedOutputMatches($expected, 'table', $data, $options);
|
||||
}
|
||||
|
||||
function testTableWithWordWrapping4()
|
||||
{
|
||||
$options = new FormatterOptions();
|
||||
|
||||
$data = [
|
||||
'name' => ['label' => 'Name', 'sep' => ':', 'value' => 'Rex', ],
|
||||
'species' => ['label' => 'Species', 'sep' => ':', 'value' => 'dog', ],
|
||||
'food' => ['label' => 'Food', 'sep' => ':', 'value' => 'kibble', ],
|
||||
'legs' => ['label' => 'Legs', 'sep' => ':', 'value' => '4', ],
|
||||
'description' => ['label' => 'Description', 'sep' => ':', 'value' => 'Rex is a very good dog, Brett. He likes kibble, and has four legs.', ],
|
||||
];
|
||||
$data = new RowsOfFields($data);
|
||||
$expected = <<<EOT
|
||||
------------- ----- -----------------------------------------------------
|
||||
Label Sep Value
|
||||
------------- ----- -----------------------------------------------------
|
||||
Name : Rex
|
||||
Species : dog
|
||||
Food : kibble
|
||||
Legs : 4
|
||||
Description : Rex is a very good dog, Brett. He likes kibble, and
|
||||
has four legs.
|
||||
------------- ----- -----------------------------------------------------
|
||||
EOT;
|
||||
$options->setWidth(78);
|
||||
$this->assertFormattedOutputMatches($expected, 'table', $data, $options);
|
||||
}
|
||||
|
||||
function testTableWithWordWrapping5()
|
||||
{
|
||||
$options = new FormatterOptions();
|
||||
$data = [
|
||||
'name' => ['Name', ':', 'Rex', ],
|
||||
'species' => ['Species', ':', 'dog', ],
|
||||
'food' => ['Food', ':', 'kibble', ],
|
||||
'legs' => ['Legs', ':', '4', ],
|
||||
'description' => ['Description', ':', 'Rex is a very good dog, Brett. He likes kibble, and has four legs.', ],
|
||||
];
|
||||
$data = new RowsOfFields($data);
|
||||
$expected = <<<EOT
|
||||
Name : Rex
|
||||
Species : dog
|
||||
Food : kibble
|
||||
Legs : 4
|
||||
Description : Rex is a very good dog, Brett. He likes kibble, and has
|
||||
four legs.
|
||||
EOT;
|
||||
$options->setWidth(78);
|
||||
$options->setIncludeFieldLables(false);
|
||||
$options->setTableStyle('compact');
|
||||
$this->assertFormattedOutputMatches($expected, 'table', $data, $options);
|
||||
}
|
||||
|
||||
@@ -842,6 +1037,17 @@ EOT;
|
||||
-----
|
||||
EOT;
|
||||
$this->assertFormattedOutputMatches($expectedSingleField, 'table', $data, $configurationData, ['field' => 'San']);
|
||||
|
||||
$expectedEmptyColumn = <<<EOT
|
||||
-----
|
||||
San
|
||||
-----
|
||||
EOT;
|
||||
|
||||
$this->assertFormattedOutputMatches($expectedEmptyColumn, 'table', new RowsOfFields([]), $configurationData, ['field' => 'San']);
|
||||
|
||||
$this->assertFormattedOutputMatches('', '', new RowsOfFields([]), $configurationData, ['field' => 'San']);
|
||||
$this->assertFormattedOutputMatches('[]', 'json', new RowsOfFields([]), $configurationData, ['field' => 'San']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -941,6 +1147,20 @@ EOT;
|
||||
->setFieldLabels(['one' => 'I', 'two' => 'II', 'three' => 'III']);
|
||||
$this->assertFormattedOutputMatches($expected, 'table', $data, $formatterOptionsWithFieldLables);
|
||||
|
||||
$expectedDrushStyleTable = <<<EOT
|
||||
One : apple
|
||||
Two : banana
|
||||
Three : carrot
|
||||
EOT;
|
||||
|
||||
// If we provide field labels, then the output will change to reflect that.
|
||||
$formatterOptionsWithFieldLables = new FormatterOptions();
|
||||
$formatterOptionsWithFieldLables
|
||||
->setTableStyle('compact')
|
||||
->setListDelimiter(':');
|
||||
$this->assertFormattedOutputMatches($expectedDrushStyleTable, 'table', $data, $formatterOptionsWithFieldLables);
|
||||
|
||||
|
||||
// Adding an extra field that does not exist in the data set should not change the output
|
||||
$formatterOptionsWithExtraFieldLables = new FormatterOptions();
|
||||
$formatterOptionsWithExtraFieldLables
|
||||
@@ -1261,8 +1481,8 @@ EOT;
|
||||
{
|
||||
"name": "widget-collection",
|
||||
"description": "A couple of widgets.",
|
||||
"widgets": [
|
||||
{
|
||||
"widgets": {
|
||||
"usual": {
|
||||
"name": "usual",
|
||||
"colors": [
|
||||
"red",
|
||||
@@ -1275,7 +1495,7 @@ EOT;
|
||||
"triangle"
|
||||
]
|
||||
},
|
||||
{
|
||||
"unusual": {
|
||||
"name": "unusual",
|
||||
"colors": [
|
||||
"muave",
|
||||
@@ -1288,7 +1508,7 @@ EOT;
|
||||
"trapazoid"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
EOT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user