Description: Fix unit tests so as not to fail on reprotest as root
 When the phpunit tests are run as root the test Log_test::test_configuration
 fails because it can write to the /root/ dir while the test expects
 that /root/ is not writeable.
 .
 This takes upstreams patch for this.
 Typically, 'reprotest' jobs are run as root user

From 127c44dfe4dcb42f506efaa0812a7e5afec99ac9 Mon Sep 17 00:00:00 2001
From: George Petculescu <gxgpet@gmail.com>
Date: Thu, 1 Dec 2022 13:20:43 +0200
Subject: [PATCH] Fixes #6174

Improves Log_test::test_configuration() test
---
 tests/codeigniter/core/Log_test.php | 6 +++---
 tests/mocks/ci_testcase.php         | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

--- a/tests/codeigniter/core/Log_test.php
+++ b/tests/codeigniter/core/Log_test.php
@@ -16,14 +16,14 @@
 		$enabled    = new ReflectionProperty('CI_Log', '_enabled');
 		$enabled->setAccessible(TRUE);
 
-		$this->ci_set_config('log_path', '/root/');
+		$this->ci_set_config('log_path', $this->ci_readonly_dir->url());
 		$this->ci_set_config('log_threshold', 'z');
 		$this->ci_set_config('log_date_format', 'd.m.Y');
 		$this->ci_set_config('log_file_extension', '');
 		$this->ci_set_config('log_file_permissions', '');
 		$instance = new CI_Log();
 
-		$this->assertEquals($path->getValue($instance), '/root/');
+		$this->assertNotFalse(strpos($path->getValue($instance), 'application/readonly'));
 		$this->assertEquals($threshold->getValue($instance), 1);
 		$this->assertEquals($date_fmt->getValue($instance), 'd.m.Y');
 		$this->assertEquals($file_ext->getValue($instance), 'php');
@@ -37,7 +37,7 @@
 		$this->ci_set_config('log_file_permissions', 0600);
 		$instance = new CI_Log();
 
-		$this->assertEquals($path->getValue($instance), APPPATH.'logs/');
+		$this->assertEquals($path->getValue($instance), $this->ci_vfs_root->url().'application/logs'.DIRECTORY_SEPARATOR);
 		$this->assertEquals($threshold->getValue($instance), 0);
 		$this->assertEquals($date_fmt->getValue($instance), 'Y-m-d H:i:s');
 		$this->assertEquals($file_ext->getValue($instance), 'log');
--- a/tests/mocks/ci_testcase.php
+++ b/tests/mocks/ci_testcase.php
@@ -5,6 +5,7 @@
 	public $ci_vfs_root;
 	public $ci_app_root;
 	public $ci_base_root;
+	public $ci_readonly_dir;
 	protected $ci_instance;
 	protected static $ci_test_instance;
 
@@ -39,6 +40,7 @@
 		$this->ci_app_root = vfsStream::newDirectory('application')->at($this->ci_vfs_root);
 		$this->ci_base_root = vfsStream::newDirectory('system')->at($this->ci_vfs_root);
 		$this->ci_view_root = vfsStream::newDirectory('views')->at($this->ci_app_root);
+		$this->ci_readonly_dir = vfsStream::newDirectory('readonly', 555)->at($this->ci_app_root);
 
 		if (method_exists($this, 'set_up'))
 		{
