diff -pruN 3.1.13+dfsg1-6/debian/changelog 3.1.13+dfsg1-7/debian/changelog
--- 3.1.13+dfsg1-6/debian/changelog	2025-02-03 11:20:00.000000000 +0000
+++ 3.1.13+dfsg1-7/debian/changelog	2025-08-26 07:51:09.000000000 +0000
@@ -1,3 +1,11 @@
+php-codeigniter-framework (3.1.13+dfsg1-7) unstable; urgency=medium
+
+  * Bump Standards-Version to 4.7.0 (no change required)
+  * d/rules: check for 'nocheck' DEB_BUILD_OPTIONS
+  * Add patches to fix tests when using phpunit 12.
+
+ -- Fab Stz <fabstz-it@yahoo.fr>  Tue, 26 Aug 2025 09:51:09 +0200
+
 php-codeigniter-framework (3.1.13+dfsg1-6) unstable; urgency=medium
 
   * add patches to support PHP8.x for XMLRPC
diff -pruN 3.1.13+dfsg1-6/debian/control 3.1.13+dfsg1-7/debian/control
--- 3.1.13+dfsg1-6/debian/control	2025-02-03 11:20:00.000000000 +0000
+++ 3.1.13+dfsg1-7/debian/control	2025-03-28 06:13:45.000000000 +0000
@@ -15,7 +15,7 @@ Build-Depends: debhelper-compat (= 13),
                python3-sphinxcontrib.phpdomain <!nodoc>,
                python3-venv <!nodoc>,
                python3-pip <!nodoc>,
-Standards-Version: 4.6.2
+Standards-Version: 4.7.0
 Rules-Requires-Root: binary-targets
 Homepage: https://codeigniter.com/
 Vcs-Browser: https://salsa.debian.org/php-team/pear/php-codeigniter-framework
diff -pruN 3.1.13+dfsg1-6/debian/patches/series 3.1.13+dfsg1-7/debian/patches/series
--- 3.1.13+dfsg1-6/debian/patches/series	2025-02-03 11:20:00.000000000 +0000
+++ 3.1.13+dfsg1-7/debian/patches/series	2025-08-26 07:50:15.000000000 +0000
@@ -38,3 +38,7 @@ tests/0008-fix-error-with-phpunit10-asse
 #tests/0003-fix-error-with-phpunit10-migrate-configuration.patch
 
 tests/20-fix-ftbfs-with-php8.3-update-expectation-for-highlight-code.patch
+tests/21-phpunit12-part1-update-phpunit.xml-schema.patch
+tests/21-phpunit12-part2-remove-__construct.patch
+tests/21-phpunit12-part3-replace-annotations-by-attributes.patch
+tests/21-phpunit12-part4-use-willReturn.patch
diff -pruN 3.1.13+dfsg1-6/debian/patches/tests/21-phpunit12-part1-update-phpunit.xml-schema.patch 3.1.13+dfsg1-7/debian/patches/tests/21-phpunit12-part1-update-phpunit.xml-schema.patch
--- 3.1.13+dfsg1-6/debian/patches/tests/21-phpunit12-part1-update-phpunit.xml-schema.patch	1970-01-01 00:00:00.000000000 +0000
+++ 3.1.13+dfsg1-7/debian/patches/tests/21-phpunit12-part1-update-phpunit.xml-schema.patch	2025-08-26 07:50:15.000000000 +0000
@@ -0,0 +1,30 @@
+Description: Update tests to work with PHPUnit 12
+ Updated with `phpunit  --migrate-configuration`
+Origin: self
+Author: Fab Stz <fabstz-it@yahoo.fr>
+Last-Update: 2025-08-26
+
+--- a/tests/phpunit.xml
++++ b/tests/phpunit.xml
+@@ -1,10 +1,5 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+-<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./Bootstrap.php" colors="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
+-  <coverage>
+-    <include>
+-      <directory suffix=".php">../system/</directory>
+-    </include>
+-  </coverage>
++<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./Bootstrap.php" colors="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.3/phpunit.xsd" cacheDirectory=".phpunit.cache">
+   <testsuites>
+     <testsuite name="CodeIgniter Core Test Suite">
+       <directory suffix="test.php">./codeigniter/core</directory>
+@@ -12,4 +7,9 @@
+       <directory suffix="test.php">./codeigniter/libraries</directory>
+     </testsuite>
+   </testsuites>
++  <source>
++    <include>
++      <directory suffix=".php">../system/</directory>
++    </include>
++  </source>
+ </phpunit>
diff -pruN 3.1.13+dfsg1-6/debian/patches/tests/21-phpunit12-part2-remove-__construct.patch 3.1.13+dfsg1-7/debian/patches/tests/21-phpunit12-part2-remove-__construct.patch
--- 3.1.13+dfsg1-6/debian/patches/tests/21-phpunit12-part2-remove-__construct.patch	1970-01-01 00:00:00.000000000 +0000
+++ 3.1.13+dfsg1-7/debian/patches/tests/21-phpunit12-part2-remove-__construct.patch	2025-08-26 07:50:15.000000000 +0000
@@ -0,0 +1,29 @@
+Description: Update tests to work with PHPUnit 12
+ PHP Fatal error:  Cannot override final method PHPUnit\Framework\TestCase::__construct() in /src/tests/mocks/ci_testcase.php on line 29
+ .
+ Fatal error: Cannot override final method PHPUnit\Framework\TestCase::__construct() in /src/tests/mocks/ci_testcase.php on line 29
+Bug: https://github.com/bcit-ci/CodeIgniter/issues/6319
+Origin: self
+Author: Fab Stz <fabstz-it@yahoo.fr>
+Last-Update: 2025-08-26
+
+--- a/tests/mocks/ci_testcase.php
++++ b/tests/mocks/ci_testcase.php
+@@ -26,16 +26,9 @@ class CI_TestCase extends \PHPUnit\Framework\TestCase {
+ 
+ 	// --------------------------------------------------------------------
+ 
+-	public function __construct($name = null, array $data = array(), $dataName = '')
+-	{
+-		parent::__construct($name, $data, $dataName);
+-		$this->ci_instance = new stdClass();
+-	}
+-
+-	// --------------------------------------------------------------------
+-
+ 	public function setUp(): void
+ 	{
++		$this->ci_instance = new stdClass();
+ 		self::$ci_test_instance = $this;
+ 		// Setup VFS with base directories
+ 		$this->ci_vfs_root = vfsStream::setup('');
diff -pruN 3.1.13+dfsg1-6/debian/patches/tests/21-phpunit12-part3-replace-annotations-by-attributes.patch 3.1.13+dfsg1-7/debian/patches/tests/21-phpunit12-part3-replace-annotations-by-attributes.patch
--- 3.1.13+dfsg1-6/debian/patches/tests/21-phpunit12-part3-replace-annotations-by-attributes.patch	1970-01-01 00:00:00.000000000 +0000
+++ 3.1.13+dfsg1-7/debian/patches/tests/21-phpunit12-part3-replace-annotations-by-attributes.patch	2025-08-26 07:50:15.000000000 +0000
@@ -0,0 +1,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()
diff -pruN 3.1.13+dfsg1-6/debian/patches/tests/21-phpunit12-part4-use-willReturn.patch 3.1.13+dfsg1-7/debian/patches/tests/21-phpunit12-part4-use-willReturn.patch
--- 3.1.13+dfsg1-6/debian/patches/tests/21-phpunit12-part4-use-willReturn.patch	1970-01-01 00:00:00.000000000 +0000
+++ 3.1.13+dfsg1-7/debian/patches/tests/21-phpunit12-part4-use-willReturn.patch	2025-08-26 07:50:15.000000000 +0000
@@ -0,0 +1,71 @@
+Description: Update tests to work with PHPUnit 12
+ Replace deprecated will($this->returnValue(FALSE)) by willReturn(FALSE)
+ Deprecated in phpunit 11, removed in phpunit 12
+Origin: self
+Author: Fab Stz <fabstz-it@yahoo.fr>
+Last-Update: 2025-08-26
+
+--- a/tests/codeigniter/helpers/language_helper_test.php
++++ b/tests/codeigniter/helpers/language_helper_test.php
+@@ -6,7 +6,7 @@
+ 	{
+ 		$this->helper('language');
+ 		$lang = $this->getMockBuilder('CI_Lang')->onlyMethods(array('line'))->getMock();
+-		$lang->expects($this->any())->method('line')->will($this->returnValue(FALSE));
++		$lang->expects($this->any())->method('line')->willReturn(FALSE);
+ 		$this->ci_instance_var('lang', $lang);
+ 
+ 		$this->assertFalse(lang(1));
+--- a/tests/codeigniter/libraries/Calendar_test.php
++++ b/tests/codeigniter/libraries/Calendar_test.php
+@@ -8,7 +8,7 @@
+ 		$this->ci_instance_var('load', $this->getMockBuilder('CI_Loader')->onlyMethods(array('helper'))->getMock());
+ 
+ 		$lang = $this->getMockBuilder('CI_Lang')->onlyMethods(array('load', 'line'))->getMock();
+-		$lang->expects($this->any())->method('line')->will($this->returnValue(FALSE));
++		$lang->expects($this->any())->method('line')->willReturn(FALSE);
+ 		$this->ci_instance_var('lang', $lang);
+ 
+ 		$this->calendar = new CI_Calendar();
+--- a/tests/codeigniter/helpers/date_helper_test.php
++++ b/tests/codeigniter/helpers/date_helper_test.php
+@@ -26,7 +26,7 @@
+ 		$config = $this->getMockBuilder('CI_Config')->getMock();
+ 		$config->expects($this->any())
+ 			   ->method('item')
+-			   ->will($this->returnValue('local'));
++			   ->willReturn('local');
+ 
+ 		// Add the stub to our test instance
+ 		$this->ci_instance_var('config', $config);
+@@ -48,7 +48,7 @@
+ 		$config = $this->getMockBuilder('CI_Config')->getMock();
+ 		$config->expects($this->any())
+ 			   ->method('item')
+-			   ->will($this->returnValue('UTC'));
++			   ->willReturn('UTC');
+ 
+ 		// Add the stub to our stdClass
+ 		$this->ci_instance_var('config', $config);
+--- a/tests/codeigniter/libraries/Driver_test.php
++++ b/tests/codeigniter/libraries/Driver_test.php
+@@ -21,7 +21,7 @@
+ 		// Mock Loader->get_package_paths
+ 		$paths = 'get_package_paths';
+ 		$ldr = $this->getMockBuilder('CI_Loader')->onlyMethods(array($paths))->getMock();
+-		$ldr->expects($this->any())->method($paths)->will($this->returnValue(array(APPPATH, BASEPATH)));
++		$ldr->expects($this->any())->method($paths)->willReturn(array(APPPATH, BASEPATH));
+ 		$this->ci_instance_var('load', $ldr);
+ 
+ 		// Create mock driver library
+--- a/tests/codeigniter/libraries/Upload_test.php
++++ b/tests/codeigniter/libraries/Upload_test.php
+@@ -8,7 +8,7 @@
+ 		$ci->upload = new CI_Upload();
+ 		$ci->security = new Mock_Core_Security();
+ 		$ci->lang = $this->getMockBuilder('CI_Lang')->onlyMethods(array('load', 'line'))->getMock();
+-		$ci->lang->expects($this->any())->method('line')->will($this->returnValue(FALSE));
++		$ci->lang->expects($this->any())->method('line')->willReturn(FALSE);
+ 		$this->upload = $ci->upload;
+ 	}
+ 
diff -pruN 3.1.13+dfsg1-6/debian/rules 3.1.13+dfsg1-7/debian/rules
--- 3.1.13+dfsg1-6/debian/rules	2025-02-03 11:20:00.000000000 +0000
+++ 3.1.13+dfsg1-7/debian/rules	2025-04-25 06:22:34.000000000 +0000
@@ -7,7 +7,9 @@ include /usr/share/dpkg/pkg-info.mk
 	dh $@ --with apache2
 
 override_dh_auto_test:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
 	cd tests && phpunit
+endif
 
 debian/build-doc/pythonvenv/bin/python:
 	mkdir -p debian/build-doc/pythonvenv
