Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to not disable output buffering #50

Open
Rudloff opened this issue Apr 20, 2019 · 1 comment
Open

Add a way to not disable output buffering #50

Rudloff opened this issue Apr 20, 2019 · 1 comment

Comments

@Rudloff
Copy link

Rudloff commented Apr 20, 2019

The Archive constructor calls ob_end_clean():

ob_end_clean();

I get why you do this but it causes problems with phpunit tests (because it uses output buffering to know what the tested code outputted):

Test code or tested code did not (only) close its own output buffers

Would it be possible to add an argument to not disable output buffering?

@johnmaguire
Copy link
Contributor

For the purposes of testing, I believe you can mock out the function by doing something like this in your test file:

<?php

namespace Barracuda\ArchiveStream {
  function ob_end_clean()
  {
  }
}

namespace my\test\namespace {
    # Test code that invokes ArchiveStream here
}

This overrides ob_end_clean with a no-op function inside the ArchiveStream namespace so you won't get errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants