elliotchance / concise

✅ Concise is test framework for using plain English and minimal code, built on PHPUnit.
MIT License
45 stars 3 forks source link

unknown file/line #351

Open ostrolucky opened 7 years ago

ostrolucky commented 7 years ago
class SimpleTest extends \Concise\Core\TestCase
{
    public function testSimple()
    {
        $this->assertTrue(false);
    }
}
$ ./vendor/bin/phpunit                                                                                                                                
PHPUnit 5.7.20 by Sebastian Bergmann and contributors.

F                                                                   1 / 1 (100%)

Time: 156 ms, Memory: 4.00MB

There was 1 failure:

1) Ostrolucky\AppEventDispatcher\Test\SimpleTest::testSimple
Failed asserting that false is true.

/media/gadelat/sdata/Dropbox/src/php/AppEventDispatcher/test/SimpleTest.php:19

In Concise, notice strings "unknown file" and "Line?:"

$ ./vendor/bin/concise                                                                                                                                 
Concise v2.1.2 Photon by Elliot Chance.

1. Ostrolucky\AppEventDispatcher\Test\SimpleTest::testSimple

   Failed asserting that false is true.

   test/SimpleTest.php
       Line 19: PHPUnit_Framework_Assert::assertTrue()
   (unknown file)
       Line ?: Ostrolucky\AppEventDispatcher\Test\SimpleTest->testSimple()

1 assertion, 0 seconds
elliotchance commented 7 years ago

This is a bug, but I'm not sure how it would be fixed. The reason that concise prints out (unknown file) is because the file and line information is not in the PHP backtrace. I'm not sure if PHPUnit uses other method to try and track down more information.

ostrolucky commented 7 years ago

If you notice, both show line 19, but concise also tries to show some another line (I guess line where function starts?) Which phpunit doesn't do

elliotchance commented 7 years ago

In this case, yes. But I've seen in most cases the full stack trace* is correct.

* The stack trace is actually pruned to not include the extra frames for within the concise library.