From 20d9b0a9c03955da0010a3df91adcd9b8e6e7d58 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 20 Dec 2017 19:57:39 +0200 Subject: Merge pull request #5354 from carusogabriel/refactoring-tests Refactoring tests Conflicts resolved: tests/codeigniter/core/Utf8_test.php tests/codeigniter/database/query_builder/group_test.php tests/codeigniter/libraries/Form_validation_test.php --- tests/codeigniter/core/Benchmark_test.php | 4 ++-- tests/codeigniter/core/Common_test.php | 6 +++--- tests/codeigniter/core/Input_test.php | 8 ++++---- tests/codeigniter/core/Log_test.php | 4 ++-- tests/codeigniter/core/Security_test.php | 2 +- tests/codeigniter/core/Utf8_test.php | 4 ++-- tests/codeigniter/core/compat/password_test.php | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) (limited to 'tests/codeigniter/core') diff --git a/tests/codeigniter/core/Benchmark_test.php b/tests/codeigniter/core/Benchmark_test.php index 63b0e3d5a..33bd742b2 100644 --- a/tests/codeigniter/core/Benchmark_test.php +++ b/tests/codeigniter/core/Benchmark_test.php @@ -15,7 +15,7 @@ class Benchmark_test extends CI_TestCase { $this->benchmark->mark('code_start'); - $this->assertEquals(1, count($this->benchmark->marker)); + $this->assertCount(1, $this->benchmark->marker); $this->assertArrayHasKey('code_start', $this->benchmark->marker); } @@ -64,4 +64,4 @@ class Benchmark_test extends CI_TestCase { $this->assertEquals('{memory_usage}', $this->benchmark->memory_usage()); } -} \ No newline at end of file +} diff --git a/tests/codeigniter/core/Common_test.php b/tests/codeigniter/core/Common_test.php index ca19e5de0..effae50c5 100644 --- a/tests/codeigniter/core/Common_test.php +++ b/tests/codeigniter/core/Common_test.php @@ -4,8 +4,8 @@ class Common_test extends CI_TestCase { public function test_is_php() { - $this->assertEquals(TRUE, is_php('1.2.0')); - $this->assertEquals(FALSE, is_php('9999.9.9')); + $this->assertTrue(is_php('1.2.0')); + $this->assertFalse(is_php('9999.9.9')); } // ------------------------------------------------------------------------ @@ -66,4 +66,4 @@ class Common_test extends CI_TestCase { $removed_string = 'Here is a string containing url_encoded invisible text.'; $this->assertEquals($removed_string, remove_invisible_characters($raw_string)); } -} \ No newline at end of file +} diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php index e1f4011b5..976941d41 100644 --- a/tests/codeigniter/core/Input_test.php +++ b/tests/codeigniter/core/Input_test.php @@ -24,8 +24,8 @@ class Input_test extends CI_TestCase { public function test_get_not_exists() { - $this->assertTrue($this->input->get() === array()); - $this->assertTrue($this->input->get('foo') === NULL); + $this->assertSame(array(), $this->input->get()); + $this->assertNull($this->input->get('foo')); } // -------------------------------------------------------------------- @@ -55,8 +55,8 @@ class Input_test extends CI_TestCase { public function test_post_not_exists() { - $this->assertTrue($this->input->post() === array()); - $this->assertTrue($this->input->post('foo') === NULL); + $this->assertSame(array(), $this->input->post()); + $this->assertNull($this->input->post('foo')); } // -------------------------------------------------------------------- diff --git a/tests/codeigniter/core/Log_test.php b/tests/codeigniter/core/Log_test.php index d5a6fcb6b..103af342b 100644 --- a/tests/codeigniter/core/Log_test.php +++ b/tests/codeigniter/core/Log_test.php @@ -28,7 +28,7 @@ class Log_test extends CI_TestCase { $this->assertEquals($date_fmt->getValue($instance), 'd.m.Y'); $this->assertEquals($file_ext->getValue($instance), 'php'); $this->assertEquals($file_perms->getValue($instance), 0644); - $this->assertEquals($enabled->getValue($instance), FALSE); + $this->assertFalse($enabled->getValue($instance)); $this->ci_set_config('log_path', ''); $this->ci_set_config('log_threshold', '0'); @@ -60,4 +60,4 @@ class Log_test extends CI_TestCase { "LEVEL - Timestamp --> Message\n" ); } -} \ No newline at end of file +} diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php index 4c54ec9fa..c3113adba 100644 --- a/tests/codeigniter/core/Security_test.php +++ b/tests/codeigniter/core/Security_test.php @@ -252,7 +252,7 @@ class Security_test extends CI_TestCase { // Perform hash $this->security->xss_hash(); - $this->assertTrue(preg_match('#^[0-9a-f]{32}$#iS', $this->security->xss_hash) === 1); + $this->assertRegExp('#^[0-9a-f]{32}$#iS', $this->security->xss_hash); } // -------------------------------------------------------------------- diff --git a/tests/codeigniter/core/Utf8_test.php b/tests/codeigniter/core/Utf8_test.php index 7e6ffd930..a0327dbd7 100644 --- a/tests/codeigniter/core/Utf8_test.php +++ b/tests/codeigniter/core/Utf8_test.php @@ -61,7 +61,7 @@ class Utf8_test extends CI_TestCase { elseif (ICONV_ENABLED) { // This is a known issue, iconv doesn't always work with //IGNORE - $this->assertTrue(in_array($this->utf8->clean_string($illegal_utf8), array('тест', ''), TRUE)); + $this->assertContains($utf8->clean_string($illegal_utf8), array('тест', '')); } else { @@ -88,4 +88,4 @@ class Utf8_test extends CI_TestCase { } } -} \ No newline at end of file +} diff --git a/tests/codeigniter/core/compat/password_test.php b/tests/codeigniter/core/compat/password_test.php index 77f5eba4e..b6dbcfab1 100644 --- a/tests/codeigniter/core/compat/password_test.php +++ b/tests/codeigniter/core/compat/password_test.php @@ -156,4 +156,4 @@ class password_test extends CI_TestCase { $this->assertTrue(password_verify('rasmuslerdorf', '$2a$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi')); } -} \ No newline at end of file +} -- cgit v1.2.3-24-g4f1b