Skip to content

Commit 49b0a5a

Browse files
Issue #6 Guaranteed parameter order for test regardless of what filesystem provides
1 parent eedf797 commit 49b0a5a

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

tests/library/EngineBlock/Test/Corto/Module/BindingsTest.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testResponseRedirectIsNotSupported()
3636
* @param string $xmlFile
3737
* @param string $certificateFile
3838
*
39-
* @dataProvider responseFilePathsProvider
39+
* @dataProvider responseProvider
4040
*/
4141
public function testInvalidNameId($xmlFile, $certificateFile)
4242
{
@@ -47,12 +47,6 @@ public function testInvalidNameId($xmlFile, $certificateFile)
4747

4848
$publicCertificate = file_get_contents($certificateFile);
4949

50-
// tmp fix, please correct the contents of the pem files with the results of this method
51-
if (!strstr($publicCertificate, 'CERTIFICATE')) {
52-
$publicCertificate = EngineBlock_X509Certificate::getPublicPemCertFromCertData($publicCertificate);
53-
echo "Please correct the contents of '{$certificateFile}' files with '{$publicCertificate}'";
54-
}
55-
5650
$publicKey = openssl_pkey_get_public($publicCertificate);
5751

5852
if (isset($element['ds:Signature'])) {
@@ -77,27 +71,29 @@ public function testInvalidNameId($xmlFile, $certificateFile)
7771
}
7872

7973
/**
80-
* Provides a list of paths to response xml files
74+
* Provides a list of paths to response xml files and certificate files
8175
*
8276
* @return array
8377
*/
84-
public function responseFilePathsProvider()
78+
public function responseProvider()
8579
{
8680
$responseFiles = array();
81+
$certificateFiles = array();
8782
$responsesDir = new DirectoryIterator(TEST_RESOURCES_DIR . '/saml/responses');
8883
/** @var $responseFile DirectoryIterator */
8984
foreach($responsesDir as $responseFile) {
9085
if ($responseFile->isFile() && !$responseFile->isDot()) {
9186
$extension = substr($responseFile->getFilename(), -3);
9287
$fileNameWithoutExtension = substr($responseFile->getFilename(), 0, -4);
93-
$responseFiles[$fileNameWithoutExtension]['certificateFile'] = $responseFile->getRealPath();
88+
9489
if ($extension == 'cer') {
90+
$certificateFiles[$fileNameWithoutExtension] = $responseFile->getRealPath();
9591
} elseif ($extension == 'xml') {
96-
$responseFiles[$fileNameWithoutExtension]['responseXmlFile'] = $responseFile->getRealPath();
92+
$responseFiles[$fileNameWithoutExtension] = $responseFile->getRealPath();
9793
}
9894
}
9995
}
10096

101-
return $responseFiles;
97+
return array_merge_recursive($responseFiles, $certificateFiles);
10298
}
10399
}

0 commit comments

Comments
 (0)