Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions .docker/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ FROM ghcr.io/glpi-project/glpi-development-env:$PHP_VERSION

USER root

# Use apache configuration suitable for GLPI 10.x
RUN cp /etc/apache2/sites-available/glpi-10.x.conf /etc/apache2/sites-available/000-default.conf

# Allow extra PHP configuration to be placed in a dedicated folder than can serve
# as a volume
ENV PHP_INI_SCAN_DIR "/usr/local/etc/php/conf.d/:/usr/local/etc/php/custom_conf.d/"
Expand Down
2 changes: 0 additions & 2 deletions .github/actions/test_tests-web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
set -e -u -x -o pipefail

php -S localhost:8088 phpunit/router.php &>/dev/null &
bin/console config:set --config-dir=./tests/config --context=inventory enabled_inventory 1
vendor/bin/phpunit phpunit/web
bin/console config:set --config-dir=./tests/config --context=inventory enabled_inventory 0
32 changes: 31 additions & 1 deletion phpunit/APIBaseClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -1758,14 +1758,26 @@ protected function checkEmptyContentRange($data, $headers)

public function testUndisclosedNotificationContent()
{
global $DB;

$user = getItemByTypeName('User', TU_USER);

// Enable notifications
Config::setConfigurationValues('core', [
'use_notifications' => '1',
'notifications_mailing' => '1',
]);

// Empty existing notifications
$DB->delete(
QueuedNotification::getTable(),
[
'itemtype' => User::class,
'items_id' => $user->getID(),
]
);

// Trigger a notification sending
$user = getItemByTypeName('User', TU_USER);
$this->query(
'lostPassword',
[
Expand Down Expand Up @@ -1795,6 +1807,12 @@ public function testUndisclosedNotificationContent()
[
'itemtype' => QueuedNotification::class,
'headers' => ['Session-Token' => $data['session_token']],
'query' => [
'searchText' => [
'itemtype' => User::class,
'items_id' => $user->getID(),
],
],
],
200
);
Expand All @@ -1821,6 +1839,18 @@ public function testUndisclosedNotificationContent()
'headers' => ['Session-Token' => $data['session_token']],
'query' => [
'reset' => 'reset',
'criteria' => [
[
'field' => 20,
'searchtype' => 'equals',
'value' => User::class,
],
[
'field' => 21,
'searchtype' => 'equals',
'value' => $user->getID(),
],
],
'forcedisplay' => [12, 13],
],
],
Expand Down
6 changes: 6 additions & 0 deletions phpunit/web/Glpi/Inventory/InventoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

namespace tests\units\Glpi\Inventory;

use Config;
use GuzzleHttp;

class InventoryTest extends \GLPITestCase
Expand All @@ -48,6 +49,11 @@ public function setUp(): void
$this->http_client = new GuzzleHttp\Client();
$this->base_uri = trim($CFG_GLPI['url_base'], "/") . "/";

// Enable inventory
Config::setConfigurationValues('inventory', [
'enabled_inventory' => '1',
]);

parent::setUp();
}

Expand Down
6 changes: 6 additions & 0 deletions phpunit/web/Glpi/Inventory/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

namespace tests\units\Glpi\Inventory;

use Config;
use GuzzleHttp;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\Response;
Expand All @@ -50,6 +51,11 @@ public function setUp(): void
$this->http_client = new GuzzleHttp\Client();
$this->base_uri = trim($CFG_GLPI['url_base'], "/") . "/";

// Enable inventory
Config::setConfigurationValues('inventory', [
'enabled_inventory' => '1',
]);

parent::setUp();
}

Expand Down