Git Product home page Git Product logo

Comments (9)

robiningelbrecht avatar robiningelbrecht commented on July 4, 2024

@Bilge You can use this extension that uses Collision: https://github.com/robiningelbrecht/phpunit-pretty-print

from collision.

Bilge avatar Bilge commented on July 4, 2024

OK, but that seems like it does a lot more than just enable Collision, what with the Chuck Norris quotes and other unnecessary guff.

In reality, isn't this the single and only line that is actually needed to enable the printer?

https://github.com/robiningelbrecht/phpunit-pretty-print/blob/5d42dbf9d92a6299d3307d59b1a67c9eba22e065/src/PhpUnitExtension.php#L35

from collision.

robiningelbrecht avatar robiningelbrecht commented on July 4, 2024

@Bilge Everything is disabled by default.
And yes that line is the bare minimum you need to run Collision, but I think you need to run it in an PHPUnit extension to make it work.

from collision.

Bilge avatar Bilge commented on July 4, 2024

I imagine you could just run it in the bootstrap file, no?

from collision.

robiningelbrecht avatar robiningelbrecht commented on July 4, 2024

@Bilge That might an option as well indeed, never tried this before.
Since PHPUnit 10 I tend to work with the "extensions and events" it provides...

from collision.

Bilge avatar Bilge commented on July 4, 2024

It seems this is wrong. There appears to be some autoload trick going on that causes EnsurePrinterIsRegisteredSubscriber::register(); to be called automatically (see Autoload.php). Therefore, the only thing required to enable the printer is to ensure COLLISION_PRINTER environment variable is set (to anything, including nothing).

However, when I do this, although the printer is enabled, the output is messed up as it is now a mish-mash of Collision and PHPUnit output (it outputs the dots (...) between tests). Moreover, the text colour is dark grey which is difficult to read; I don't know if this is intended or not, but it wasn't the case with v6.

image

If I use your extension, the dots go away, but the text is still illegible. Presumably the dots are fixed by instructing PHPUnit to omit its own test output as here: https://github.com/robiningelbrecht/phpunit-pretty-print/blob/5d42dbf9d92a6299d3307d59b1a67c9eba22e065/src/PhpUnitExtension.php#L24C18-L24C39 What is strange about this is that there does not appear to be any equivalent call in Collision itself. But how do we even know Collision v7 even works with PHPUnit, considering its own test suite does not appear to activate the printer at all?


Aside, the text colour in v6 was also grey, but a lot lighter.

image

from collision.

robiningelbrecht avatar robiningelbrecht commented on July 4, 2024

@Bilge yeah indeed, you need to disable PHPUnit10's output, forgot about that, sorry.

But how do we even know Collision v7 even works with PHPUnit

Because the extension you are referring to has it's own test suite and proves it works?

from collision.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.