improvements to get the HHVM build to pass
This commit is contained in:
parent
36c1b17777
commit
c175abaf77
3 changed files with 10 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
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
|
||||
if (!defined('PUBLIC_PATH')) define('PUBLIC_PATH', '..');
|
||||
|
|
|
@ -24,9 +24,9 @@ class trafficlimiterTest extends PHPUnit_Framework_TestCase
|
|||
trafficlimiter::setLimit(4);
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$this->assertTrue(trafficlimiter::canPass(), 'first request may pass');
|
||||
sleep(2);
|
||||
sleep(1);
|
||||
$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');
|
||||
$_SERVER['REMOTE_ADDR'] = '2001:1620:2057:dead:beef::cafe:babe';
|
||||
$this->assertTrue(trafficlimiter::canPass(), 'fourth request has different ip and may pass');
|
||||
|
|
|
@ -124,7 +124,9 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
|||
$file = PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess';
|
||||
@unlink($file);
|
||||
}
|
||||
ob_start();
|
||||
new zerobin;
|
||||
ob_end_clean();
|
||||
foreach ($dirs as $dir) {
|
||||
$file = PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess';
|
||||
$this->assertFileExists(
|
||||
|
@ -145,7 +147,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
|||
file_put_contents(CONF, '');
|
||||
ob_start();
|
||||
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['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
trafficlimiter::setLimit(30);
|
||||
trafficlimiter::canPass();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
|
@ -312,6 +315,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
|||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
$time = time();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
$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');
|
||||
$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');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue