0

I know ideally that I should fix all the places in my code where PHP Notices are being thrown but for now I am trying to get a simple test up and running for one part of the application.

When I try to run my test using

sudo phpunit -c tests/phpunit.xml tests/

I get the following notices:

PHP Notice:  Undefined property: stdClass::$integer_value in /var/www/application/authenticate.php on line 111
PHP Notice:  Undefined property: stdClass::$boolean_value in /var/www/application/authenticate.php on line 115
PHP Notice:  Undefined property: stdClass::$boolean_value in /var/www/application/site/authenticate.php on line 115
PHP Notice:  Undefined property: stdClass::$integer_value in /var/www/application/authenticate.php on line 111

I've tried following the advice on this answer to a similar question https://stackoverflow.com/a/8412996/3263538

and have created a phpunit.xml configuration file which includes the following xml to ignore notices and warnings

tests/phpunit.xml

<phpunit convertErrorsToExceptions="false"
         convertNoticesToExceptions="false"
         convertWarningEToExceptions="false">
</phpunit>

UtilitesTest.php (dummy test that returns true)

<?php
use PHPUnit\Framework\TestCase;

include_once "/var/www/application/utilities.php";

class UtilitiesTest extends TestCase
{
    public function testEmpty()
    {
        return 1;
    }

}
?>

but still no luck. Is there something I'm missing here? Ideally I'd like to suppress these Notice messages.

Community
  • 1
  • 1

0 Answers0