From 033c9729af6d66e3806d52382c5bc5f48ae8b63b Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 11 Jul 2017 10:58:31 +0200 Subject: Test inserting bigint values in DB Signed-off-by: Florian Pritz --- application/test/tests/test_database_schema.php | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 application/test/tests/test_database_schema.php diff --git a/application/test/tests/test_database_schema.php b/application/test/tests/test_database_schema.php new file mode 100644 index 000000000..02f188e1f --- /dev/null +++ b/application/test/tests/test_database_schema.php @@ -0,0 +1,38 @@ + + * + * Licensed under AGPLv3 + * (see COPYING for full license text) + * + */ + +namespace test\tests; + +class test_database_schema extends \test\Test { + + public function __construct() + { + parent::__construct(); + } + + public function test_file_storage_bigint() { + $filesize = pow(2, 35) + 1; + + $CI =& get_instance(); + $CI->db->insert("file_storage", array( + "filesize" => $filesize, + "mimetype" => "text/plain", + "hash" => md5("test"), + "date" => time(), + )); + $id = $CI->db->insert_id(); + $db_value = $CI->db->select('filesize') + ->from('file_storage') + ->where('id', $id) + ->get()->result_array()[0]["filesize"]; + $this->t->is(intval($db_value), $filesize, "Large filesize is stored correctly in db"); + } + + +} -- cgit v1.2.3-24-g4f1b