From ae4c651033f36c2e0495aa640cdd4659136da50a Mon Sep 17 00:00:00 2001 From: Rom1-B <8530352+Rom1-B@users.noreply.github.com> Date: Tue, 25 Aug 2026 08:00:56 +0200 Subject: [PATCH 1/2] Fix: repair failing host authorization test --- CHANGELOG.md | 4 ++++ tests/HostTest.php | 23 +++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11eb0d7..ca6082b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [UNRELEASED] + + + ## [1.1.3] - 2026-08-03 ### Fixed diff --git a/tests/HostTest.php b/tests/HostTest.php index 54b2e24..ece2a65 100644 --- a/tests/HostTest.php +++ b/tests/HostTest.php @@ -30,12 +30,15 @@ namespace GlpiPlugin\Centreon\tests; +use Auth; use Computer; +use Glpi\Tests\DbTestCase; use GlpiPlugin\Centreon\ApiClient; use GlpiPlugin\Centreon\Host; -use PHPUnit\Framework\TestCase; +use Session; +use User; -class HostTest extends TestCase +class HostTest extends DbTestCase { public function testGetComputerList() { @@ -52,7 +55,23 @@ public function testGetComputerList() public function testOneHost() { + $auth = new Auth(); + $auth->user = getItemByTypeName(User::class, 'glpi'); + $auth->auth_succeded = true; + Session::init($auth); + + $computer = $this->createItem(Computer::class, [ + 'entities_id' => 0, + 'name' => 'centreon host computer', + ]); + $computers_id = $computer->getID(); + $id = 88; + $this->createItem(Host::class, [ + 'itemtype' => 'Computer', + 'items_id' => $computers_id, + 'centreon_id' => $id, + ]); $api = $this->getMockBuilder(ApiClient::class) ->disableOriginalConstructor() From 13a0e27a3c85cb5f902fc07907f2bee204d81e05 Mon Sep 17 00:00:00 2001 From: Rom1-B <8530352+Rom1-B@users.noreply.github.com> Date: Thu, 27 Aug 2026 09:30:08 +0200 Subject: [PATCH 2/2] stan --- tests/HostTest.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/HostTest.php b/tests/HostTest.php index ece2a65..8cae0f2 100644 --- a/tests/HostTest.php +++ b/tests/HostTest.php @@ -30,13 +30,10 @@ namespace GlpiPlugin\Centreon\tests; -use Auth; use Computer; use Glpi\Tests\DbTestCase; use GlpiPlugin\Centreon\ApiClient; use GlpiPlugin\Centreon\Host; -use Session; -use User; class HostTest extends DbTestCase { @@ -55,10 +52,7 @@ public function testGetComputerList() public function testOneHost() { - $auth = new Auth(); - $auth->user = getItemByTypeName(User::class, 'glpi'); - $auth->auth_succeded = true; - Session::init($auth); + $this->login('glpi'); $computer = $this->createItem(Computer::class, [ 'entities_id' => 0,