Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 21 additions & 2 deletions tests/HostTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the dedicated login() function, since we’re now using DbTestCase?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


$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()
Expand Down