Skip to content

Commit

Permalink
Fixing width of plain text (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis authored Apr 16, 2022
1 parent 44697e8 commit 4366765
Show file tree
Hide file tree
Showing 7 changed files with 211 additions and 220 deletions.
6 changes: 2 additions & 4 deletions src/Formats/PlainText/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function __construct(string $testCaseName)

$this->table = new SymfonyTable($this->buffer);
$this->table->setHeaders(['Line:Column', 'Severity', 'Message']);
$this->table->setColumnWidth(2, 60);
$this->table->setColumnMaxWidth(2, 140);
$this->table->setColumnWidth(2, 80);
$this->table->setColumnMaxWidth(2, 80);

if ('' !== $testCaseName) {
$this->testCaseName = $testCaseName;
Expand Down Expand Up @@ -103,9 +103,7 @@ public function render(): string
->setHeaderTitle($this->testCaseName)
->setFooterTitle($this->testCaseName);

$this->buffer->writeln('');
$this->buffer->writeln("## Test Case: {$this->testCaseName}");
$this->buffer->writeln('');
}

$this->table->render();
Expand Down
3 changes: 2 additions & 1 deletion tests/GeneralSuite/ConverterPlainTextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ public function testPlainTextPrinter()
$case1 = $suite1->addCase('src/Class.php');
$case1->line = 123;
$case1->column = 4;
$case1->message = 'Something went wrong #1';
$case1->message = "Something went wrong once again. It's a really really really long-long-long-long message.\n"
. "Another line.\n";

$suite2 = $plainText->addSuite();
$case2 = $suite2->addCase('src/AnotherFile.php');
Expand Down
103 changes: 51 additions & 52 deletions tests/fixtures/test-cases/ConverterPlainTextTest/testCheckStyle.txt
Original file line number Diff line number Diff line change
@@ -1,57 +1,56 @@
## Test Case: src/JUnit/JUnitXml.php

+-------------+----------+---------------------------------------------- src/JUnit/JUnitXml.php ------------------------------------------------------------------------+
| Line:Column | Severity | Message |
+-------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------+
| 37 | Error | Assigning $this->rootElement of type \DOMElement|false to property but \JBZoo\CiReportConverter\JUnit\JUnitXml->rootElement is \DOMElement ( |
| | | false is incompatible) |
| | | Rule : PhanPossiblyFalseTypeMismatchProperty |
| | | File Path: src/JUnit/JUnitXml.php:37 |
| | | Severity : warning |
+-------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------+
| 44 | Error | Can use \JBZoo\CiReportConverter\JUnit\TestSuiteElement as a return type of addTestSuite |
| | | Rule : PhanPluginCanUseReturnType |
| | | File Path: src/JUnit/JUnitXml.php:44 |
| | | Severity : warning |
+-------------+----------+---------------------------------------------- src/JUnit/JUnitXml.php ------------------------------------------------------------------------+

+-------------+----------+---------------- src/JUnit/JUnitXml.php ------------------------------------------+
| Line:Column | Severity | Message |
+-------------+----------+----------------------------------------------------------------------------------+
| 37 | Error | Assigning $this->rootElement of type \DOMElement|false to property but \JBZoo\Ci |
| | | ReportConverter\JUnit\JUnitXml->rootElement is \DOMElement (false is incompatibl |
| | | e) |
| | | Rule : PhanPossiblyFalseTypeMismatchProperty |
| | | File Path: src/JUnit/JUnitXml.php:37 |
| | | Severity : warning |
+-------------+----------+----------------------------------------------------------------------------------+
| 44 | Error | Can use \JBZoo\CiReportConverter\JUnit\TestSuiteElement as a return type of addT |
| | | estSuite |
| | | Rule : PhanPluginCanUseReturnType |
| | | File Path: src/JUnit/JUnitXml.php:44 |
| | | Severity : warning |
+-------------+----------+---------------- src/JUnit/JUnitXml.php ------------------------------------------+

## Test Case: src/JUnit/TestCaseElement.php

+-------------+----------+------------------------------------------- src/JUnit/TestCaseElement.php --------------------------------------------------------------------+
| Line:Column | Severity | Message |
+-------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------+
| 34 | Error | Can use string as the type of parameter $name of setName |
| | | Rule : PhanPluginCanUseParamType |
| | | File Path: src/JUnit/TestCaseElement.php:34 |
| | | Severity : warning |
+-------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------+
| 36 | Error | Suspicious order for argument name - This is getting passed to parameter #1 (string $name) of \JBZoo\CiReportConverter\JUnit\TestCaseElement |
| | | ::setAttribute(string $name, string $value) |
| | | Rule : PhanPluginSuspiciousParamPositionInternal |
| | | File Path: src/JUnit/TestCaseElement.php:36 |
| | | Severity : warning |
+-------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------+
| 42 | Error | Can use string as the type of parameter $classname of setClassname |
| | | Rule : PhanPluginCanUseParamType |
| | | File Path: src/JUnit/TestCaseElement.php:42 |
| | | Severity : warning |
+-------------+----------+------------------------------------------- src/JUnit/TestCaseElement.php --------------------------------------------------------------------+

+-------------+----------+------------- src/JUnit/TestCaseElement.php --------------------------------------+
| Line:Column | Severity | Message |
+-------------+----------+----------------------------------------------------------------------------------+
| 34 | Error | Can use string as the type of parameter $name of setName |
| | | Rule : PhanPluginCanUseParamType |
| | | File Path: src/JUnit/TestCaseElement.php:34 |
| | | Severity : warning |
+-------------+----------+----------------------------------------------------------------------------------+
| 36 | Error | Suspicious order for argument name - This is getting passed to parameter #1 (str |
| | | ing $name) of \JBZoo\CiReportConverter\JUnit\TestCaseElement::setAttribute(strin |
| | | g $name, string $value) |
| | | Rule : PhanPluginSuspiciousParamPositionInternal |
| | | File Path: src/JUnit/TestCaseElement.php:36 |
| | | Severity : warning |
+-------------+----------+----------------------------------------------------------------------------------+
| 42 | Error | Can use string as the type of parameter $classname of setClassname |
| | | Rule : PhanPluginCanUseParamType |
| | | File Path: src/JUnit/TestCaseElement.php:42 |
| | | Severity : warning |
+-------------+----------+------------- src/JUnit/TestCaseElement.php --------------------------------------+

## Test Case: src/JUnit/TestSuiteElement.php

+-------------+----------+------------------------------------------ src/JUnit/TestSuiteElement.php --------------------------------------------------------------------+
| Line:Column | Severity | Message |
+-------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------+
| 35 | Error | Can use string as the type of parameter $name of setName |
| | | Rule : PhanPluginCanUseParamType |
| | | File Path: src/JUnit/TestSuiteElement.php:35 |
| | | Severity : warning |
+-------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------+
| 37 | Error | Suspicious order for argument name - This is getting passed to parameter #1 (string $name) of \JBZoo\CiReportConverter\JUnit\TestSuiteElemen |
| | | t::setAttribute(string $name, string $value) |
| | | Rule : PhanPluginSuspiciousParamPositionInternal |
| | | File Path: src/JUnit/TestSuiteElement.php:37 |
| | | Severity : warning |
+-------------+----------+------------------------------------------ src/JUnit/TestSuiteElement.php --------------------------------------------------------------------+
+-------------+----------+------------ src/JUnit/TestSuiteElement.php --------------------------------------+
| Line:Column | Severity | Message |
+-------------+----------+----------------------------------------------------------------------------------+
| 35 | Error | Can use string as the type of parameter $name of setName |
| | | Rule : PhanPluginCanUseParamType |
| | | File Path: src/JUnit/TestSuiteElement.php:35 |
| | | Severity : warning |
+-------------+----------+----------------------------------------------------------------------------------+
| 37 | Error | Suspicious order for argument name - This is getting passed to parameter #1 (str |
| | | ing $name) of \JBZoo\CiReportConverter\JUnit\TestSuiteElement::setAttribute(stri |
| | | ng $name, string $value) |
| | | Rule : PhanPluginSuspiciousParamPositionInternal |
| | | File Path: src/JUnit/TestSuiteElement.php:37 |
| | | Severity : warning |
+-------------+----------+------------ src/JUnit/TestSuiteElement.php --------------------------------------+
Loading

0 comments on commit 4366765

Please sign in to comment.