Merge branch '4.4' into 5.2
* 4.4: Fix intersection types on tests [Console] fix table setHeaderTitle without headers
This commit is contained in:
commit
3d8feb86ed
|
@ -167,7 +167,7 @@ class AnnotationsCacheWarmerTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return MockObject|Reader
|
||||
* @return MockObject&Reader
|
||||
*/
|
||||
private function getReadOnlyReader(): object
|
||||
{
|
||||
|
|
|
@ -84,7 +84,7 @@ class CachePoolDeleteCommandTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return MockObject|KernelInterface
|
||||
* @return MockObject&KernelInterface
|
||||
*/
|
||||
private function getKernel(): object
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ class CachePruneCommandTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return MockObject|KernelInterface
|
||||
* @return MockObject&KernelInterface
|
||||
*/
|
||||
private function getKernel(): object
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ class CachePruneCommandTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return MockObject|PruneableInterface
|
||||
* @return MockObject&PruneableInterface
|
||||
*/
|
||||
private function getPruneableInterfaceMock(): object
|
||||
{
|
||||
|
|
|
@ -218,7 +218,7 @@ class TagAwareAdapterTest extends AdapterTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return MockObject|PruneableCacheInterface
|
||||
* @return MockObject&PruneableCacheInterface
|
||||
*/
|
||||
private function getPruneableMock(): AdapterInterface
|
||||
{
|
||||
|
|
|
@ -362,6 +362,7 @@ class Table
|
|||
|
||||
$isHeader = !$this->horizontal;
|
||||
$isFirstRow = $this->horizontal;
|
||||
$hasTitle = (bool) $this->headerTitle;
|
||||
foreach ($rows as $row) {
|
||||
if ($divider === $row) {
|
||||
$isHeader = false;
|
||||
|
@ -379,12 +380,13 @@ class Table
|
|||
}
|
||||
|
||||
if ($isHeader || $isFirstRow) {
|
||||
if ($isFirstRow) {
|
||||
$this->renderRowSeparator(self::SEPARATOR_TOP_BOTTOM);
|
||||
$isFirstRow = false;
|
||||
} else {
|
||||
$this->renderRowSeparator(self::SEPARATOR_TOP, $this->headerTitle, $this->style->getHeaderTitleFormat());
|
||||
}
|
||||
$this->renderRowSeparator(
|
||||
$isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
|
||||
$hasTitle ? $this->headerTitle : null,
|
||||
$hasTitle ? $this->style->getHeaderTitleFormat() : null
|
||||
);
|
||||
$isFirstRow = false;
|
||||
$hasTitle = false;
|
||||
}
|
||||
if ($this->horizontal) {
|
||||
$this->renderRow($row, $this->style->getCellRowFormat(), $this->style->getCellHeaderFormat());
|
||||
|
|
|
@ -1322,6 +1322,27 @@ TABLE
|
|||
];
|
||||
}
|
||||
|
||||
public function testSetTitleWithoutHeaders()
|
||||
{
|
||||
(new Table($output = $this->getOutputStream()))
|
||||
->setHeaderTitle('Reproducer')
|
||||
->setRows([
|
||||
['Value', '123-456'],
|
||||
['Some other value', '789-0'],
|
||||
])
|
||||
->render();
|
||||
|
||||
$expected = <<<'TABLE'
|
||||
+-------- Reproducer --------+
|
||||
| Value | 123-456 |
|
||||
| Some other value | 789-0 |
|
||||
+------------------+---------+
|
||||
|
||||
TABLE;
|
||||
|
||||
$this->assertSame($expected, $this->getOutputContent($output));
|
||||
}
|
||||
|
||||
public function testColumnMaxWidths()
|
||||
{
|
||||
$table = new Table($output = $this->getOutputStream());
|
||||
|
|
|
@ -860,7 +860,7 @@ XML;
|
|||
}
|
||||
|
||||
/**
|
||||
* @return MockObject|NormalizerInterface
|
||||
* @return MockObject&NormalizerInterface
|
||||
*/
|
||||
private function createMockDateTimeNormalizer(): object
|
||||
{
|
||||
|
|
Reference in New Issue