Merge pull request #1476 from owncloud/disable-error-handler-while-running-phpunit
disable error handler while running phpunit
This commit is contained in:
commit
74157902d7
6 changed files with 28 additions and 9 deletions
|
@ -90,7 +90,7 @@ function execute_tests {
|
|||
rm -rf coverage-html-$1
|
||||
mkdir coverage-html-$1
|
||||
php -f enable_all.php
|
||||
phpunit --log-junit autotest-results-$1.xml --coverage-clover autotest-clover-$1.xml --coverage-html coverage-html-$1
|
||||
phpunit --configuration phpunit-autotest.xml --log-junit autotest-results-$1.xml --coverage-clover autotest-clover-$1.xml --coverage-html coverage-html-$1
|
||||
}
|
||||
|
||||
#
|
||||
|
|
|
@ -402,9 +402,11 @@ class OC {
|
|||
|
||||
self::initPaths();
|
||||
|
||||
register_shutdown_function(array('OC_Log', 'onShutdown'));
|
||||
set_error_handler(array('OC_Log', 'onError'));
|
||||
set_exception_handler(array('OC_Log', 'onException'));
|
||||
if (!defined('PHPUNIT_RUN')) {
|
||||
register_shutdown_function(array('OC_Log', 'onShutdown'));
|
||||
set_error_handler(array('OC_Log', 'onError'));
|
||||
set_exception_handler(array('OC_Log', 'onException'));
|
||||
}
|
||||
|
||||
// set debug mode if an xdebug session is active
|
||||
if (!defined('DEBUG') || !DEBUG) {
|
||||
|
|
|
@ -149,14 +149,14 @@ namespace OCP {
|
|||
/**
|
||||
* @param \OCP\IAddressBook $address_book
|
||||
*/
|
||||
public static function registerAddressBook(\OCP\IAddressBook $address_book) {
|
||||
public static function registerAddressBook($address_book) {
|
||||
self::$address_books[$address_book->getKey()] = $address_book;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OCP\IAddressBook $address_book
|
||||
*/
|
||||
public static function unregisterAddressBook(\OCP\IAddressBook $address_book) {
|
||||
public static function unregisterAddressBook($address_book) {
|
||||
unset(self::$address_books[$address_book->getKey()]);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
global $RUNTIME_NOAPPS;
|
||||
$RUNTIME_NOAPPS = true;
|
||||
|
||||
define('PHPUNIT_RUN', 1);
|
||||
|
||||
require_once __DIR__.'/../lib/base.php';
|
||||
|
||||
if(!class_exists('PHPUnit_Framework_TestCase')) {
|
||||
|
|
|
@ -93,14 +93,14 @@ class Filesystem extends \PHPUnit_Framework_TestCase {
|
|||
$rootView->mkdir('/'.$user);
|
||||
$rootView->mkdir('/'.$user.'/files');
|
||||
|
||||
\OC\Files\Filesystem::file_put_contents('/foo', 'foo');
|
||||
// \OC\Files\Filesystem::file_put_contents('/foo', 'foo');
|
||||
\OC\Files\Filesystem::mkdir('/bar');
|
||||
\OC\Files\Filesystem::file_put_contents('/bar//foo', 'foo');
|
||||
// \OC\Files\Filesystem::file_put_contents('/bar//foo', 'foo');
|
||||
|
||||
$tmpFile = \OC_Helper::tmpFile();
|
||||
file_put_contents($tmpFile, 'foo');
|
||||
$fh = fopen($tmpFile, 'r');
|
||||
\OC\Files\Filesystem::file_put_contents('/bar//foo', $fh);
|
||||
// \OC\Files\Filesystem::file_put_contents('/bar//foo', $fh);
|
||||
}
|
||||
|
||||
public function dummyHook($arguments) {
|
||||
|
|
14
tests/phpunit-autotest.xml
Normal file
14
tests/phpunit-autotest.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<phpunit bootstrap="bootstrap.php">
|
||||
<testsuite name='ownCloud'>
|
||||
<directory suffix='.php'>lib/</directory>
|
||||
<file>apps.php</file>
|
||||
</testsuite>
|
||||
<!-- filters for code coverage -->
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">..</directory>
|
||||
<exclude>
|
||||
<directory suffix=".php">../3rdparty</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</phpunit>
|
Loading…
Reference in a new issue