sebastianbergmann/phpunit — Issue #390: ErrorException: Notice: ob_end_clean(): failed to delete buffer.
Author: sebastianblum
Created: 2011-11-01 10:42:14+00:00
State: open

Hello!

I'am using symfony 2.0.4 and the example was working with phpunit 3.5.15.

Since the upgrade to phpunit 3.6 i get the following output:

phpunit -c app
#!/usr/local/Cellar/php/5.3.6/bin/php
PHPUnit 3.6.0 by Sebastian Bergmann.

Configuration read from /Users/sebiprivat/Downloads/Symfony/app/phpunit.xml.dist

.E

Time: 1 second, Memory: 25.50Mb

There was 1 error:

1) Acme\DemoBundle\Tests\Controller\DemoControllerTest::testInvalidName
ErrorException: Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in /usr/local/Cellar/php/5.3.6/lib/php/PHPUnit/Framework/TestCase.php line 833

/Users/sebiprivat/Downloads/Symfony/vendor/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php:65
/usr/local/Cellar/php/5.3.6/bin/phpunit:46

FAILURES!
Tests: 2, Assertions: 2, Errors: 1.
MacPro:Symfony sebiprivat$

---------------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce the error:

1. Download Symfony v2.0.4 with vendors
http://symfony.com/download?v=Symfony_Standard_Vendors_2.0.4.tgz

2. Go into the directory and run phpunit -c app
There should be one test in the Acme Demo Bundle

3. Now I want to test, that symphony throws a NotFoundException (will display a 404 error page) if no name was given

I edited in src/Acme/DemoBundle/Controller/DemoController.php to

/**
* @Route("/hello/{name}", name="_demo_hello")
* @Template()
*/
public function helloAction($name)
{
if (!$name) {
throw new NotFoundHttpException("No Name!");
}

return array('name' => $name);
}

and added a new test in src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php

public function testInvalidName()
{
$client = $this->createClient();

$crawler = $client->request('GET', '/demo/hello/');

$this->assertTrue($client->getResponse()->isNotFound());
}

Now running phpunit -c app will get the following output:

phpunit -c app
#!/usr/local/Cellar/php/5.3.6/bin/php
PHPUnit 3.6.0 by Sebastian Bergmann.

Configuration read from /Users/sebiprivat/Downloads/Symfony/app/phpunit.xml.dist

.E

Time: 1 second, Memory: 25.50Mb

There was 1 error:

1) Acme\DemoBundle\Tests\Controller\DemoControllerTest::testInvalidName
ErrorException: Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in /usr/local/Cellar/php/5.3.6/lib/php/PHPUnit/Framework/TestCase.php line 833

/Users/sebiprivat/Downloads/Symfony/vendor/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php:65
/usr/local/Cellar/php/5.3.6/bin/phpunit:46

FAILURES!
Tests: 2, Assertions: 2, Errors: 1.
MacPro:Symfony sebiprivat$