summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2018-06-07 21:13:55 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2018-06-07 21:13:55 +0300
commit2b39ed5dfb56fa01e38ee8540973f4eb42a1ff82 (patch)
tree67011675a55f37f61e7ee2d630f3912486c93f86 /test
parent0f0fb35620280f5eb9df041772a9454e2d51e0f0 (diff)
downloadunit-2b39ed5dfb56fa01e38ee8540973f4eb42a1ff82.tar.gz
unit-2b39ed5dfb56fa01e38ee8540973f4eb42a1ff82.tar.bz2
Tests: added tests for "precision" option in php.ini.
Diffstat (limited to 'test')
-rw-r--r--test/php/ini_precision/index.php4
-rw-r--r--test/php/ini_precision/php.ini1
-rw-r--r--test/test_php_application.py12
-rw-r--r--test/unit.py1
4 files changed, 18 insertions, 0 deletions
diff --git a/test/php/ini_precision/index.php b/test/php/ini_precision/index.php
new file mode 100644
index 00000000..3b733e5c
--- /dev/null
+++ b/test/php/ini_precision/index.php
@@ -0,0 +1,4 @@
+<?php
+header('X-File: ' . php_ini_loaded_file());
+header('X-Precision: ' . ini_get('precision'));
+?>
diff --git a/test/php/ini_precision/php.ini b/test/php/ini_precision/php.ini
new file mode 100644
index 00000000..51dbdede
--- /dev/null
+++ b/test/php/ini_precision/php.ini
@@ -0,0 +1 @@
+precision = 4
diff --git a/test/test_php_application.py b/test/test_php_application.py
index 9ac063c7..37467019 100644
--- a/test/test_php_application.py
+++ b/test/test_php_application.py
@@ -118,5 +118,17 @@ class TestUnitPHPApplication(unit.TestUnitApplicationPHP):
self.assertEqual(resp['headers']['X-Cookie-1'], 'val', 'cookie')
self.assertEqual(resp['headers']['X-Cookie-2'], 'val2', 'cookie')
+ def test_php_application_ini_precision(self):
+ self.load('ini_precision')
+
+ self.assertNotEqual(self.get()['headers']['X-Precision'], '4',
+ 'ini value default')
+
+ self.conf({"file": "php.ini"}, '/applications/ini_precision/options')
+
+ self.assertEqual(self.get()['headers']['X-File'],
+ self.current_dir + '/php/ini_precision/php.ini', 'ini file')
+ self.assertEqual(self.get()['headers']['X-Precision'], '4', 'ini value')
+
if __name__ == '__main__':
unittest.main()
diff --git a/test/unit.py b/test/unit.py
index 2f187d91..06ee2d76 100644
--- a/test/unit.py
+++ b/test/unit.py
@@ -395,6 +395,7 @@ class TestUnitApplicationPHP(TestUnitApplicationProto):
"type": "php",
"processes": { "spare": 0 },
"root": self.current_dir + '/php/' + script,
+ "working_directory": self.current_dir + '/php/' + script,
"index": name
}
}