-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure the last element of the stack trace has a line number. otherwise don't print the editor url fixes #2
- Loading branch information
Showing
6 changed files
with
74 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,24 @@ | |
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of WickedOne\PHPUnitPrinter. | ||
* | ||
* (c) wicliff <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace WickedOne\PHPUnitPrinter\Tests; | ||
|
||
use PHPUnit\Framework\AssertionFailedError; | ||
use PHPUnit\Framework\ErrorTestCase; | ||
use PHPUnit\Framework\TestCase; | ||
use PHPUnit\Framework\TestResult; | ||
use PHPUnit\Framework\TestSuite; | ||
use WickedOne\PHPUnitPrinter\PhpStormPrinter; | ||
use WickedOne\PHPUnitPrinter\Tests\Stub\EmptyTestClass; | ||
|
||
/** | ||
* PhpStorm Printer Test. | ||
|
@@ -17,10 +28,9 @@ | |
*/ | ||
class PhpStormPrinterTest extends TestCase | ||
{ | ||
|
||
/** | ||
* check for presence of editor url in output file | ||
* and whether original messages are still printed | ||
* and whether original messages are still printed. | ||
*/ | ||
public function testPrintDefectFooter(): void | ||
{ | ||
|
@@ -30,10 +40,9 @@ public function testPrintDefectFooter(): void | |
|
||
$result->addFailure($test, $throwable, time()); | ||
|
||
$filename = sys_get_temp_dir() . '/phpunit-printer.txt'; | ||
touch($filename); | ||
$filename = sys_get_temp_dir().'/phpunit-printer.txt'; | ||
|
||
$printer = new PhpStormPrinter(fopen($filename, 'rb+')); | ||
$printer = new PhpStormPrinter(fopen($filename, 'wb+')); | ||
$printer->printResult($result); | ||
|
||
$result = file_get_contents($filename); | ||
|
@@ -45,4 +54,29 @@ public function testPrintDefectFooter(): void | |
|
||
@unlink($filename); | ||
} | ||
|
||
/** | ||
* in some occasions no trace is provided. | ||
* make sure printing editor url isn't printed in those occasions. | ||
*/ | ||
public function testSkipDefectFooterOnWarning(): void | ||
{ | ||
$result = (new TestSuite(EmptyTestClass::class))->run(); | ||
|
||
$filename = sys_get_temp_dir().'/phpunit-printer.txt'; | ||
|
||
$list = $GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST'] ?? null; | ||
$GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST'] = [__FILE__]; | ||
|
||
$printer = new PhpStormPrinter(fopen($filename, 'wb+')); | ||
$printer->printResult($result); | ||
|
||
$GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST'] = $list; | ||
|
||
$result = file_get_contents($filename); | ||
|
||
self::assertStringNotContainsString('phpstorm://open?file=', $result); | ||
|
||
@unlink($filename); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of WickedOne\PHPUnitPrinter. | ||
* | ||
* (c) wicliff <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace WickedOne\PHPUnitPrinter\Tests\Stub; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* EmptyTest Class. | ||
* | ||
* @author wicliff <[email protected]> | ||
*/ | ||
class EmptyTestClass extends TestCase | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the SolrPHP SolariumBundle. | ||
* This file is part of WickedOne\PHPUnitPrinter. | ||
* | ||
* (c) wicliff <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|