Tests: added a test for fastcgi_finish_request() function.
This commit is contained in:
11
test/php/fastcgi_finish_request/index.php
Normal file
11
test/php/fastcgi_finish_request/index.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
if (!isset($_GET['skip'])) {
|
||||||
|
echo "0123";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fastcgi_finish_request()) {
|
||||||
|
error_log("Error in fastcgi_finish_request");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "4567";
|
||||||
|
?>
|
||||||
@@ -94,6 +94,32 @@ class TestPHPApplication(TestApplicationPHP):
|
|||||||
assert resp['status'] == 200, 'query string empty status'
|
assert resp['status'] == 200, 'query string empty status'
|
||||||
assert resp['headers']['Query-String'] == '', 'query string empty'
|
assert resp['headers']['Query-String'] == '', 'query string empty'
|
||||||
|
|
||||||
|
def test_php_application_fastcgi_finish_request(self, temp_dir):
|
||||||
|
self.load('fastcgi_finish_request')
|
||||||
|
|
||||||
|
assert self.get()['body'] == '0123'
|
||||||
|
|
||||||
|
unit_stop()
|
||||||
|
|
||||||
|
with open(temp_dir + '/unit.log', 'r', errors='ignore') as f:
|
||||||
|
errs = re.findall(r'Error in fastcgi_finish_request', f.read())
|
||||||
|
|
||||||
|
assert len(errs) == 0, 'no error'
|
||||||
|
|
||||||
|
def test_php_application_fastcgi_finish_request_2(self, temp_dir):
|
||||||
|
self.load('fastcgi_finish_request')
|
||||||
|
|
||||||
|
resp = self.get(url='/?skip')
|
||||||
|
assert resp['status'] == 200
|
||||||
|
assert resp['body'] == ''
|
||||||
|
|
||||||
|
unit_stop()
|
||||||
|
|
||||||
|
with open(temp_dir + '/unit.log', 'r', errors='ignore') as f:
|
||||||
|
errs = re.findall(r'Error in fastcgi_finish_request', f.read())
|
||||||
|
|
||||||
|
assert len(errs) == 0, 'no error'
|
||||||
|
|
||||||
def test_php_application_query_string_absent(self):
|
def test_php_application_query_string_absent(self):
|
||||||
self.load('query_string')
|
self.load('query_string')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user