Browse Source

Make tests work with 4.8 at least

tags/v11.0RC2
Joas Schilling 7 years ago
parent
commit
db710e0b03
No account linked to committer's email address
3 changed files with 24 additions and 6 deletions
  1. 3
    3
      autotest-external.sh
  2. 3
    3
      autotest.sh
  3. 18
    0
      tests/lib/TestCase.php

+ 3
- 3
autotest-external.sh View File

} }


if ! [ -x "$PHPUNIT" ]; then if ! [ -x "$PHPUNIT" ]; then
echo "phpunit executable not found, please install phpunit version >= 3.7" >&2
echo "phpunit executable not found, please install phpunit version >= 4.8" >&2
exit 3 exit 3
fi fi


PHPUNIT_MAJOR_VERSION=$(echo $PHPUNIT_VERSION | cut -d"." -f1) PHPUNIT_MAJOR_VERSION=$(echo $PHPUNIT_VERSION | cut -d"." -f1)
PHPUNIT_MINOR_VERSION=$(echo $PHPUNIT_VERSION | cut -d"." -f2) PHPUNIT_MINOR_VERSION=$(echo $PHPUNIT_VERSION | cut -d"." -f2)


if ! [ $PHPUNIT_MAJOR_VERSION -gt 4 -o \( $PHPUNIT_MAJOR_VERSION -eq 4 -a $PHPUNIT_MINOR_VERSION -ge 4 \) ]; then
echo "phpunit version >= 4.4 required. Version found: $PHPUNIT_VERSION" >&2
if ! [ $PHPUNIT_MAJOR_VERSION -gt 4 -o \( $PHPUNIT_MAJOR_VERSION -eq 4 -a $PHPUNIT_MINOR_VERSION -ge 8 \) ]; then
echo "phpunit version >= 4.8 required. Version found: $PHPUNIT_VERSION" >&2
exit 4 exit 4
fi fi



+ 3
- 3
autotest.sh View File

fi fi


if ! [ -x "$PHPUNIT" ]; then if ! [ -x "$PHPUNIT" ]; then
echo "phpunit executable not found, please install phpunit version >= 4.4" >&2
echo "phpunit executable not found, please install phpunit version >= 4.8" >&2
exit 3 exit 3
fi fi


PHPUNIT_MAJOR_VERSION=$(echo "$PHPUNIT_VERSION" | cut -d"." -f1) PHPUNIT_MAJOR_VERSION=$(echo "$PHPUNIT_VERSION" | cut -d"." -f1)
PHPUNIT_MINOR_VERSION=$(echo "$PHPUNIT_VERSION" | cut -d"." -f2) PHPUNIT_MINOR_VERSION=$(echo "$PHPUNIT_VERSION" | cut -d"." -f2)


if ! [ "$PHPUNIT_MAJOR_VERSION" -gt 4 -o \( "$PHPUNIT_MAJOR_VERSION" -eq 4 -a "$PHPUNIT_MINOR_VERSION" -ge 4 \) ]; then
echo "phpunit version >= 4.4 required. Version found: $PHPUNIT_VERSION" >&2
if ! [ "$PHPUNIT_MAJOR_VERSION" -gt 4 -o \( "$PHPUNIT_MAJOR_VERSION" -eq 4 -a "$PHPUNIT_MINOR_VERSION" -ge 8 \) ]; then
echo "phpunit version >= 4.8 required. Version found: $PHPUNIT_VERSION" >&2
exit 4 exit 4
fi fi



+ 18
- 0
tests/lib/TestCase.php View File

/** @var array */ /** @var array */
protected $services = []; protected $services = [];


/**
* Wrapper to be forward compatible to phpunit 5.4+
*
* @param string $originalClassName
* @return \PHPUnit_Framework_MockObject_MockObject
*/
protected function createMock($originalClassName) {
if (is_callable('parent::createMock')) {
return parent::createMock($originalClassName);
}

return $this->getMockBuilder($originalClassName)
->disableOriginalConstructor()
->disableOriginalClone()
->disableArgumentCloning()
->getMock();
}

/** /**
* @param string $name * @param string $name
* @param mixed $newService * @param mixed $newService

Loading…
Cancel
Save