1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
Description: Update tests to work with PHPUnit 12
Add Attributes because Annotations that were deprecated in phpunit 11
were removed in phpunit 12
Origin: self
Author: Fab Stz <fabstz-it@yahoo.fr>
Last-Update: 2025-08-26
--- a/tests/codeigniter/core/Lang_test.php
+++ b/tests/codeigniter/core/Lang_test.php
@@ -90,6 +90,7 @@
/**
* @depends test_load
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_load')]
public function test_line()
{
$this->ci_vfs_clone('system/language/english/profiler_lang.php');
--- a/tests/codeigniter/core/Security_test.php
+++ b/tests/codeigniter/core/Security_test.php
@@ -235,6 +235,8 @@
* @depends test_xss_clean_sanitize_naughty_html_tags
* @depends test_xss_clean_sanitize_naughty_html_attributes
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_xss_clean_sanitize_naughty_html_tags')]
+ #[PHPUnit\Framework\Attributes\Depends('test_xss_clean_sanitize_naughty_html_attributes')]
public function test_naughty_html_plus_evil_attributes()
{
$this->assertEquals(
--- a/tests/codeigniter/core/Utf8_test.php
+++ b/tests/codeigniter/core/Utf8_test.php
@@ -49,6 +49,7 @@
* @depends test_is_ascii
* @covers CI_Utf8::clean_string
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_is_ascii')]
public function test_clean_string()
{
$this->assertEquals('foo bar', $this->utf8->clean_string('foo bar'));
--- a/tests/codeigniter/core/compat/hash_test.php
+++ b/tests/codeigniter/core/compat/hash_test.php
@@ -22,6 +22,7 @@
*
* @depends test_bootstrap
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_bootstrap')]
public function test_hash_equals()
{
$this->assertTrue(hash_equals('same', 'same'));
@@ -42,6 +43,7 @@
*
* @depends test_bootstrap
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_bootstrap')]
public function test_hash_pbkdf2()
{
if (is_php('5.5'))
@@ -74,4 +76,4 @@
);
}
-}
\ No newline at end of file
+}
--- a/tests/codeigniter/core/compat/mbstring_test.php
+++ b/tests/codeigniter/core/compat/mbstring_test.php
@@ -18,6 +18,7 @@
/**
* @depends test_bootstrap
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_bootstrap')]
public function test_mb_strlen()
{
$this->assertEquals(ICONV_ENABLED ? 4 : 8, mb_strlen('тест'));
@@ -29,6 +30,7 @@
/**
* @depends test_bootstrap
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_bootstrap')]
public function test_mb_strpos()
{
$this->assertEquals(ICONV_ENABLED ? 2 : 4, mb_strpos('тест', 'с'));
@@ -41,6 +43,7 @@
/**
* @depends test_bootstrap
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_bootstrap')]
public function test_mb_substr()
{
$this->assertEquals(ICONV_ENABLED ? 'стинг' : 'естинг', mb_substr('тестинг', 2));
--- a/tests/codeigniter/core/compat/password_test.php
+++ b/tests/codeigniter/core/compat/password_test.php
@@ -39,6 +39,7 @@
*
* @depends test_bootstrap
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_bootstrap')]
public function test_password_get_info()
{
$expected = array(
@@ -77,6 +78,7 @@
*
* @depends test_bootstrap
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_bootstrap')]
public function test_password_hash()
{
// FALSE is returned if no CSPRNG source is available
@@ -112,6 +114,7 @@
*
* @depends test_password_get_info
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_password_get_info')]
public function test_password_needs_rehash()
{
// invalid hash: always rehash
@@ -148,6 +151,7 @@
*
* @depends test_bootstrap
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_bootstrap')]
public function test_password_verify()
{
$this->assertFalse(password_verify(123, 123));
--- a/tests/codeigniter/core/compat/standard_test.php
+++ b/tests/codeigniter/core/compat/standard_test.php
@@ -26,6 +26,7 @@
*
* @depends test_bootstrap
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_bootstrap')]
public function test_array_column()
{
// Basic tests
--- a/tests/codeigniter/database/query_builder/like_test.php
+++ b/tests/codeigniter/database/query_builder/like_test.php
@@ -110,6 +110,7 @@
*
* @dataProvider like_set_side_provider
*/
+ #[PHPUnit\Framework\Attributes\DataProvider('like_set_side_provider')]
public function test_like_set_side($str, $side, $expected_name)
{
$actual = $this->db->like('name', $str, $side)->get('job')->result_array();
--- a/tests/codeigniter/libraries/Encryption_test.php
+++ b/tests/codeigniter/libraries/Encryption_test.php
@@ -194,6 +194,8 @@
* @depends test_hkdf
* @depends test__get_params
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_hkdf')]
+ #[PHPUnit\Framework\Attributes\Depends('test__get_params')]
public function test_initialize_encrypt_decrypt()
{
$message = 'This is a plain-text message.';
@@ -223,6 +225,7 @@
*
* @depends test__get_params
*/
+ #[PHPUnit\Framework\Attributes\Depends('test__get_params')]
public function test_encrypt_decrypt_custom()
{
$message = 'Another plain-text message.';
--- a/tests/codeigniter/libraries/Table_test.php
+++ b/tests/codeigniter/libraries/Table_test.php
@@ -33,9 +33,10 @@
$this->assertEquals('awesome cap', $this->table->caption);
}
- /*
+ /**
* @depends test_prep_args
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_prep_args')]
public function test_set_heading()
{
// uses _prep_args internally, so we'll just do a quick
@@ -54,9 +55,10 @@
);
}
- /*
+ /**
* @depends test_prep_args
*/
+ #[PHPUnit\Framework\Attributes\Depends('test_prep_args')]
public function test_add_row()
{
// uses _prep_args internally, so we'll just do a quick
--- a/tests/codeigniter/libraries/Encrypt_test.php
+++ b/tests/codeigniter/libraries/Encrypt_test.php
@@ -2,6 +2,7 @@
/**
* @requires extension mcrypt
*/
+#[PHPUnit\Framework\Attributes\RequiresPhpExtension('mcrypt')]
class Encrypt_test extends CI_TestCase {
public function set_up()
|