sebastianbergmann / phpunit-mock-objects

Mock Object library for PHPUnit
https://phpunit.de/
Other
4.98k stars 153 forks source link

Fatal error: Call to protected method PHPUnit_Framework_TestCase::getMock() #350

Closed ambrt closed 7 years ago

ambrt commented 7 years ago

I updated phpunit to 5.7.8 and try to make tests from https://github.com/phpbb/phpbb/. I updated to phpunit version because previous one (4.x.x) was exiting without any output and upgrading was recommended for any bugs on 4.x.x.

Now i try to run tests and get error:

Fatal error: Call to protected method PHPUnit_Framework_TestCase::getMock() from context 'phpbb_test_case_helpers' in phpbb\tests\test_framework\phpbb_test_case_helpers.php on line 388

The part of the code that throws error is

        // Mock the DAL, make it return data from the fixture
        $mb = $this->test_case->getMockBuilder('phpbb\\textformatter\\data_access');
        $mb->setMethods(array('get_bbcodes', 'get_censored_words', 'get_smilies', 'get_styles'));
        $mb->setConstructorArgs(array(
//here line  388    $this->test_case->getMock('phpbb\\db\\driver\\driver'),
            'phpbb_bbcodes',
            'phpbb_smilies',
            'phpbb_styles',
            'phpbb_words',
            $styles_path
        ));

I'm on wndows, wampserver 3.0.3

sebastianbergmann commented 7 years ago

getMock() is protected (and deprecated, btw.).