{"issue":{"milestone":null,"user":{"id":212189,"login":"nijel","url":"https://api.github.com/users/nijel","avatar_url":"https://secure.gravatar.com/avatar/abbcd6344e160597fb2694f25c46149f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"abbcd6344e160597fb2694f25c46149f"},"title":"expectOutputString() in strict mode not working in 3.6.5","created_at":"2011-12-20T09:03:47Z","updated_at":"2011-12-20T09:03:47Z","labels":[],"state":"open","id":2610661,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"html_url":"https://github.com/sebastianbergmann/phpunit/issues/445","closed_at":null,"body":"This is followup to bug #371.\r\n\r\nWhen running example test in strict mode, I get two failures.\r\n\r\nTest case:\r\n\r\n```php\r\n<?php\r\nclass Sample_test extends PHPUnit_Framework_TestCase\r\n{\r\n\r\npublic function testExpectFooActualFoo()\r\n{\r\n    $this->expectOutputString('foo');\r\n    print 'foo';\r\n}\r\n\r\npublic function testExpectBarActualBaz()\r\n{\r\n    $this->expectOutputString('bar');\r\n    print 'baz';\r\n}\r\n}\r\n?>\r\n```\r\n\r\nOutput:\r\n\r\n```\r\nPHPUnit 3.6.5 by Sebastian Bergmann.\r\n\r\nFF\r\n\r\nTime: 0 seconds, Memory: 6.00Mb\r\n\r\nThere were 2 failures:\r\n\r\n1) Sample_test::testExpectFooActualFoo\r\nThis test printed output: foo\r\n\r\n\r\n2) Sample_test::testExpectBarActualBaz\r\nFailed asserting that two strings are equal.\r\n--- Expected\r\n+++ Actual\r\n@@ @@\r\n-'bar'\r\n+'baz'\r\n\r\n\r\nFAILURES!\r\nTests: 2, Assertions: 2, Failures: 2.\r\n```\r\n\r\nThe first test should not fail.\r\n\r\nAfter applying following fix, it works as expected.\r\n\r\n```patch\r\n--- Framework/TestCase.php.orig\t2011-12-20 10:01:40.000000000 +0100\r\n+++ Framework/TestCase.php\t2011-12-20 10:02:20.000000000 +0100\r\n@@ -407,8 +407,8 @@\r\n             return FALSE;\r\n         }\r\n \r\n-        if ($this->outputExpectedString !== NULL ||\r\n-            $this->outputExpectedRegex !== NULL) {\r\n+        if (is_null($this->outputExpectedString) &&\r\n+            is_null($this->outputExpectedRegex)) {\r\n             return FALSE;\r\n         }\r\n \r\n```\r\n\r\nOutput with patch:\r\n\r\n```\r\nPHPUnit 3.6.5 by Sebastian Bergmann.\r\n\r\n.F\r\n\r\nTime: 0 seconds, Memory: 5.75Mb\r\n\r\nThere was 1 failure:\r\n\r\n1) Sample_test::testExpectBarActualBaz\r\nFailed asserting that two strings are equal.\r\n--- Expected\r\n+++ Actual\r\n@@ @@\r\n-'bar'\r\n+'baz'\r\n\r\n\r\nFAILURES!\r\nTests: 2, Assertions: 2, Failures: 1.\r\n```","number":445,"url":"https://api.github.com/repos/sebastianbergmann/phpunit/issues/445","comments":0,"assignee":null},"action":"opened"}