From 1d75aeb2008e6e2f067540310c39aa3e43651c78 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 17 Mar 2014 12:46:18 -0500 Subject: [PATCH] test: Fixup usage of PEAR libs in testing --- setup/test/run-tests.php | 3 +++ setup/test/tests/test.crypto.php | 2 -- setup/test/tests/test.validation.php | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/setup/test/run-tests.php b/setup/test/run-tests.php index 3a3df3a1d..ecd7bb3c7 100644 --- a/setup/test/run-tests.php +++ b/setup/test/run-tests.php @@ -16,6 +16,9 @@ if (!function_exists('get_osticket_root_path')) { } } $root = get_osticket_root_path(); +define('INCLUDE_DIR', "$root/include/"); +define('PEAR_DIR', INCLUDE_DIR."pear/"); +ini_set('include_path', './'.PATH_SEPARATOR.INCLUDE_DIR.PATH_SEPARATOR.PEAR_DIR); if (!function_exists('glob_recursive')) { # Check PHP syntax across all php files diff --git a/setup/test/tests/test.crypto.php b/setup/test/tests/test.crypto.php index 3a6db8873..a8140f6da 100644 --- a/setup/test/tests/test.crypto.php +++ b/setup/test/tests/test.crypto.php @@ -1,7 +1,5 @@ <?php require_once "class.test.php"; -define('INCLUDE_DIR', realpath(dirname(__file__).'/../../../include').'/'); -define('PEAR_DIR', INCLUDE_DIR.'/pear/'); require_once INCLUDE_DIR."class.crypto.php"; class TestCrypto extends Test { diff --git a/setup/test/tests/test.validation.php b/setup/test/tests/test.validation.php index 20b1eae9a..6323cd159 100644 --- a/setup/test/tests/test.validation.php +++ b/setup/test/tests/test.validation.php @@ -33,11 +33,12 @@ class TestValidation extends Test { $this->assert(Validator::is_email('jared_12@domain.tld')); $this->assert(Validator::is_email('jared-12@domain.tld')); - // Very likely illegal + // Illegal or unsupported $this->assert(!Validator::is_email('jared r@domain.tld')); - $this->assert(Validator::is_email('jared@host')); + $this->assert(!Validator::is_email('jared')); // Odd cases, but legal + $this->assert(Validator::is_email('jared@host')); $this->assert(Validator::is_email('jared@[127.0.0.1]')); $this->assert(Validator::is_email('jared@[ipv6:::1]')); $this->assert(Validator::is_email('*@domain.tld')); -- GitLab