Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
S
stats-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
stats-facil
Validations
9bdf699c
Valider
9bdf699c
rédigé
il y a 11 ans
par
mattab
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Late static binding needed for plugin tests to override path to expected test output files
parent
b3588e22
Aucune branche associée trouvée
Branches contenant la validation
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
tests/PHPUnit/IntegrationTestCase.php
+27
-27
27 ajouts, 27 suppressions
tests/PHPUnit/IntegrationTestCase.php
avec
27 ajouts
et
27 suppressions
tests/PHPUnit/IntegrationTestCase.php
+
27
−
27
Voir le fichier @
9bdf699c
...
...
@@ -76,10 +76,10 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
public
static
function
setUpBeforeClass
()
{
s
elf
::
_setUpBeforeClass
();
s
tatic
::
_setUpBeforeClass
();
if
(
isset
(
static
::
$fixture
))
{
s
elf
::
setupFixture
(
static
::
$fixture
);
s
tatic
::
setupFixture
(
static
::
$fixture
);
}
}
...
...
@@ -122,14 +122,14 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
try
{
$fixture
->
setUp
();
}
catch
(
Exception
$e
)
{
s
elf
::
fail
(
"Failed to setup fixture: "
.
$e
->
getMessage
()
.
"
\n
"
.
$e
->
getTraceAsString
());
s
tatic
::
fail
(
"Failed to setup fixture: "
.
$e
->
getMessage
()
.
"
\n
"
.
$e
->
getTraceAsString
());
}
}
protected
static
function
teardownFixture
(
$fixture
)
{
if
(
isset
(
static
::
$fixture
))
{
s
elf
::
tearDownFixture
(
static
::
$fixture
);
s
tatic
::
tearDownFixture
(
static
::
$fixture
);
}
$fixture
->
tearDown
();
...
...
@@ -153,7 +153,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
$dbName
=
Config
::
getInstance
()
->
database
[
'dbname'
];
}
s
elf
::
connectWithoutDatabase
();
s
tatic
::
connectWithoutDatabase
();
if
(
$createEmptyDatabase
)
{
DbHelper
::
dropDatabase
();
}
...
...
@@ -168,7 +168,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
\Piwik\Plugin\Manager
::
getInstance
()
->
loadPlugins
(
array
());
}
catch
(
Exception
$e
)
{
s
elf
::
fail
(
"TEST INITIALIZATION FAILED: "
.
$e
->
getMessage
()
.
"
\n
"
.
$e
->
getTraceAsString
());
s
tatic
::
fail
(
"TEST INITIALIZATION FAILED: "
.
$e
->
getMessage
()
.
"
\n
"
.
$e
->
getTraceAsString
());
}
include
"DataFiles/SearchEngines.php"
;
...
...
@@ -185,7 +185,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
Cache
::
deleteTrackerCache
();
if
(
$installPlugins
===
null
)
$installPlugins
=
$createEmptyDatabase
;
s
elf
::
installAndLoadPlugins
(
$installPlugins
);
s
tatic
::
installAndLoadPlugins
(
$installPlugins
);
$_GET
=
$_REQUEST
=
array
();
...
...
@@ -197,8 +197,8 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
// List of Modules, or Module.Method that should not be called as part of the XML output compare
// Usually these modules either return random changing data, or are already tested in specific unit tests.
s
elf
::
setApiNotToCall
(
s
elf
::
$defaultApiNotToCall
);
s
elf
::
setApiToCall
(
array
());
s
tatic
::
setApiNotToCall
(
s
tatic
::
$defaultApiNotToCall
);
s
tatic
::
setApiToCall
(
array
());
FakeAccess
::
$superUserLogin
=
'superUserLogin'
;
...
...
@@ -208,7 +208,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
public
static
function
tearDownAfterClass
()
{
s
elf
::
_tearDownAfterClass
();
s
tatic
::
_tearDownAfterClass
();
}
public
static
function
_tearDownAfterClass
(
$dropDatabase
=
true
)
...
...
@@ -289,7 +289,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
if
(
!
is_array
(
$apiToCall
))
{
$apiToCall
=
array
(
$apiToCall
);
}
s
elf
::
$apiToCall
=
$apiToCall
;
s
tatic
::
$apiToCall
=
$apiToCall
;
}
/**
...
...
@@ -304,7 +304,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
if
(
!
is_array
(
$apiNotToCall
))
{
$apiNotToCall
=
array
(
$apiNotToCall
);
}
s
elf
::
$apiNotToCall
=
$apiNotToCall
;
s
tatic
::
$apiNotToCall
=
$apiNotToCall
;
}
protected
function
alertWhenImagesExcludedFromTests
()
...
...
@@ -486,9 +486,9 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
$apiId
=
$moduleName
.
'.'
.
$methodName
;
// If Api to test were set, we only test these
if
(
!
empty
(
s
elf
::
$apiToCall
)
&&
in_array
(
$moduleName
,
s
elf
::
$apiToCall
)
===
false
&&
in_array
(
$apiId
,
s
elf
::
$apiToCall
)
===
false
if
(
!
empty
(
s
tatic
::
$apiToCall
)
&&
in_array
(
$moduleName
,
s
tatic
::
$apiToCall
)
===
false
&&
in_array
(
$apiId
,
s
tatic
::
$apiToCall
)
===
false
)
{
// echo "Skipped $apiId... \n";
$skipped
[]
=
$apiId
;
...
...
@@ -496,8 +496,8 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
}
// Excluded modules from test
elseif
(
((
strpos
(
$methodName
,
'get'
)
!==
0
&&
$methodName
!=
'generateReport'
)
||
in_array
(
$moduleName
,
s
elf
::
$apiNotToCall
)
===
true
||
in_array
(
$apiId
,
s
elf
::
$apiNotToCall
)
===
true
||
in_array
(
$moduleName
,
s
tatic
::
$apiNotToCall
)
===
true
||
in_array
(
$apiId
,
s
tatic
::
$apiNotToCall
)
===
true
||
$methodName
==
'getLogoUrl'
||
$methodName
==
'getSVGLogoUrl'
||
$methodName
==
'hasSVGLogo'
...
...
@@ -619,7 +619,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
$abandonedCarts
=
false
,
$idGoal
=
false
,
$apiModule
=
false
,
$apiAction
=
false
,
$otherRequestParameters
=
array
(),
$supertableApi
=
false
,
$fileExtension
=
false
)
{
list
(
$pathProcessed
,
$pathExpected
)
=
s
elf
::
getProcessedAndExpectedDirs
();
list
(
$pathProcessed
,
$pathExpected
)
=
s
tatic
::
getProcessedAndExpectedDirs
();
if
(
$periods
===
false
)
{
$periods
=
'day'
;
...
...
@@ -684,12 +684,12 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
protected
function
checkEnoughUrlsAreTested
(
$requestUrls
)
{
$countUrls
=
count
(
$requestUrls
);
$approximateCountApiToCall
=
count
(
s
elf
::
$apiToCall
);
$approximateCountApiToCall
=
count
(
s
tatic
::
$apiToCall
);
if
(
empty
(
$requestUrls
)
||
$approximateCountApiToCall
>
$countUrls
)
{
throw
new
Exception
(
"Only generated
$countUrls
API calls to test but was expecting more for this test.
\n
"
.
"Want to test APIs: "
.
implode
(
", "
,
s
elf
::
$apiToCall
)
.
")
\n
"
.
"Want to test APIs: "
.
implode
(
", "
,
s
tatic
::
$apiToCall
)
.
")
\n
"
.
"But only generated these URLs:
\n
"
.
implode
(
"
\n
"
,
$requestUrls
)
.
")
\n
"
);
}
...
...
@@ -864,7 +864,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
protected
static
function
getProcessedAndExpectedDirs
()
{
$path
=
s
elf
::
getPathToTestDirectory
();
$path
=
s
tatic
::
getPathToTestDirectory
();
return
array
(
$path
.
'/processed/'
,
$path
.
'/expected/'
);
}
...
...
@@ -878,7 +878,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
$processedFilename
=
$testName
.
$filenameSuffix
;
$expectedFilename
=
(
$compareAgainst
?:
$testName
)
.
$filenameSuffix
;
list
(
$processedDir
,
$expectedDir
)
=
s
elf
::
getProcessedAndExpectedDirs
();
list
(
$processedDir
,
$expectedDir
)
=
s
tatic
::
getProcessedAndExpectedDirs
();
return
array
(
$processedDir
.
$processedFilename
,
$expectedDir
.
$expectedFilename
);
}
...
...
@@ -948,22 +948,22 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
protected
function
_setCallableApi
(
$api
)
{
if
(
$api
==
'all'
)
{
s
elf
::
setApiToCall
(
array
());
s
elf
::
setApiNotToCall
(
static
::
$defaultApiNotToCall
);
s
tatic
::
setApiToCall
(
array
());
s
tatic
::
setApiNotToCall
(
static
::
$defaultApiNotToCall
);
}
else
{
if
(
!
is_array
(
$api
))
{
$api
=
array
(
$api
);
}
s
elf
::
setApiToCall
(
$api
);
s
tatic
::
setApiToCall
(
$api
);
if
(
!
in_array
(
'UserCountry.getLocationFromIP'
,
$api
))
{
s
elf
::
setApiNotToCall
(
array
(
s
tatic
::
setApiNotToCall
(
array
(
'API.getPiwikVersion'
,
'UserCountry.getLocationFromIP'
));
}
else
{
s
elf
::
setApiNotToCall
(
array
());
s
tatic
::
setApiNotToCall
(
array
());
}
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter