Issue Bug Closed

#67092PHP7 Warning DateViewHelperTest::setLocale() should be compatible with PHPUnit_Framework_TestCase::setLocale()

Stephan Großberndt 05/21/15, 19:04 updated 10/21/17, 17:45

Description

PHP Warning:  Declaration of TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format\DateViewHelperTest::setLocale() should be compatible with PHPUnit_Framework_TestCase::setLocale() in /home/travis/build/TYPO3/TYPO3.CMS/typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/DateViewHelperTest.php on line 264

This happens because PHP7 reads the type hint in PHPUnit_Framework_TestCase:

    /**
     * This method is a wrapper for the setlocale() function that automatically
     * resets the locale to its original value after the test is run.
     *
     * @param  integer                     $category
     * @param  string                      $locale
     * @throws PHPUnit_Framework_Exception
     * @since  Method available since Release 3.1.0
     */
    protected function setLocale()
    {

while DateViewHelperTest has its own definition for setLocale which is not compatible

    /**
     * @param string $locale
     */
    protected function setLocale($locale) {
        setlocale(LC_CTYPE, $locale);
        setlocale(LC_MONETARY, $locale);
        setlocale(LC_TIME, $locale);
    }

first param int vs string.

How to deal with that? Rename the function in DateViewHelperTest ? Edit phpunit on github to remove the type hinting?

Reviews 2