improvements to get the HHVM build to pass

This commit is contained in:
El RIDO 2016-07-06 09:01:10 +02:00
parent 36c1b17777
commit c175abaf77
3 changed files with 10 additions and 5 deletions

View file

@ -1,5 +1,6 @@
<?php <?php
error_reporting( E_ALL | E_STRICT ); error_reporting( E_ALL | E_STRICT );
ini_set('hhvm.xenon.period', '0');
// change this, if your php files and data is outside of your webservers document root // change this, if your php files and data is outside of your webservers document root
if (!defined('PUBLIC_PATH')) define('PUBLIC_PATH', '..'); if (!defined('PUBLIC_PATH')) define('PUBLIC_PATH', '..');
@ -256,4 +257,4 @@ class helper
return var_export($var, $return); return var_export($var, $return);
} }
} }
} }

View file

@ -24,9 +24,9 @@ class trafficlimiterTest extends PHPUnit_Framework_TestCase
trafficlimiter::setLimit(4); trafficlimiter::setLimit(4);
$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$this->assertTrue(trafficlimiter::canPass(), 'first request may pass'); $this->assertTrue(trafficlimiter::canPass(), 'first request may pass');
sleep(2); sleep(1);
$this->assertFalse(trafficlimiter::canPass(), 'second request is to fast, may not pass'); $this->assertFalse(trafficlimiter::canPass(), 'second request is to fast, may not pass');
sleep(3); sleep(4);
$this->assertTrue(trafficlimiter::canPass(), 'third request waited long enough and may pass'); $this->assertTrue(trafficlimiter::canPass(), 'third request waited long enough and may pass');
$_SERVER['REMOTE_ADDR'] = '2001:1620:2057:dead:beef::cafe:babe'; $_SERVER['REMOTE_ADDR'] = '2001:1620:2057:dead:beef::cafe:babe';
$this->assertTrue(trafficlimiter::canPass(), 'fourth request has different ip and may pass'); $this->assertTrue(trafficlimiter::canPass(), 'fourth request has different ip and may pass');

View file

@ -124,7 +124,9 @@ class zerobinTest extends PHPUnit_Framework_TestCase
$file = PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess'; $file = PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess';
@unlink($file); @unlink($file);
} }
ob_start();
new zerobin; new zerobin;
ob_end_clean();
foreach ($dirs as $dir) { foreach ($dirs as $dir) {
$file = PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess'; $file = PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess';
$this->assertFileExists( $this->assertFileExists(
@ -145,7 +147,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
file_put_contents(CONF, ''); file_put_contents(CONF, '');
ob_start(); ob_start();
new zerobin; new zerobin;
$content = ob_get_contents(); ob_end_clean();
} }
/** /**
@ -185,6 +187,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
trafficlimiter::setLimit(30);
trafficlimiter::canPass(); trafficlimiter::canPass();
ob_start(); ob_start();
new zerobin; new zerobin;
@ -312,6 +315,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
$time = time();
ob_start(); ob_start();
new zerobin; new zerobin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -324,7 +328,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
); );
$this->assertTrue($this->_model->exists($response['id']), 'paste exists after posting data'); $this->assertTrue($this->_model->exists($response['id']), 'paste exists after posting data');
$paste = $this->_model->read($response['id']); $paste = $this->_model->read($response['id']);
$this->assertEquals(time() + 300, $paste->meta->expire_date, 'time is set correctly'); $this->assertEquals($time + 300, $paste->meta->expire_date, 'time is set correctly');
$this->assertEquals(1, $paste->meta->opendiscussion, 'time is set correctly'); $this->assertEquals(1, $paste->meta->opendiscussion, 'time is set correctly');
} }