Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GLPI
glpi
Commits
299e5188
Commit
299e5188
authored
Jun 18, 2021
by
Cédric Anne
Committed by
Johan Cwiklinski
Jun 21, 2021
Browse files
Fix tests var directories init
parent
8dacb0b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/bin/test-updated-data
View file @
299e5188
...
...
@@ -44,6 +44,8 @@ define(
include_once
(
GLPI_ROOT
.
'/inc/includes.php'
);
\
GlpiTests\Toolbox
::
initVarDirectories
();
$command
=
new
\
GlpiTests\Command\TestUpdatedDataCommand
();
$app
=
new
\
Symfony\Component\Console\Application
(
'Test empty data'
,
GLPI_VERSION
);
...
...
tests/bootstrap.php
View file @
299e5188
...
...
@@ -61,13 +61,7 @@ if (!file_exists(GLPI_CONFIG_DIR . '/config_db.php')) {
die
(
"
\n
Configuration file for tests not found
\n\n
run: bin/console glpi:database:install --config-dir=./tests ...
\n\n
"
);
}
// Create subdirectories of GLPI_VAR_DIR based on defined constants
foreach
(
get_defined_constants
()
as
$constant_name
=>
$constant_value
)
{
if
(
preg_match
(
'/^GLPI_[\w]+_DIR$/'
,
$constant_name
)
&&
preg_match
(
'/^'
.
preg_quote
(
GLPI_VAR_DIR
,
'/'
)
.
'\//'
,
$constant_value
))
{
is_dir
(
$constant_value
)
or
mkdir
(
$constant_value
,
0755
,
true
);
}
}
\
GlpiTests\Toolbox
::
initVarDirectories
();
//init cache
if
(
file_exists
(
GLPI_CONFIG_DIR
.
DIRECTORY_SEPARATOR
.
CacheManager
::
CONFIG_FILENAME
))
{
...
...
tests/src/Toolbox.php
0 → 100644
View file @
299e5188
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2021 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
namespace
GlpiTests
;
class
Toolbox
{
/**
* Create subdirectories of GLPI_VAR_DIR based on defined constants.
*
* @return void
*/
public
static
function
initVarDirectories
():
void
{
foreach
(
get_defined_constants
()
as
$name
=>
$value
)
{
if
(
preg_match
(
'/^GLPI_[\w]+_DIR$/'
,
$name
)
&&
preg_match
(
'/^'
.
preg_quote
(
GLPI_VAR_DIR
,
'/'
)
.
'\//'
,
$value
)
&&
!
is_dir
(
$value
))
{
mkdir
(
$value
,
0755
,
true
);
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment