Skip to content

Commit

Permalink
- fix failing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
softcoder committed Feb 7, 2024
1 parent 5c1816d commit 29ce94e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 27 deletions.
29 changes: 9 additions & 20 deletions php/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="vendor/autoload.php">

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="RipRunner">
<directory>tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<source>
<include>
<directory suffix=".php">./</directory>
<exclude>
<directory suffix=".php">third-party</directory>
<directory suffix=".php">vendor</directory>
</exclude>
</whitelist>
</filter>

</include>
<exclude>
<directory suffix=".php">third-party</directory>
<directory suffix=".php">vendor</directory>
</exclude>
</source>
</phpunit>
4 changes: 2 additions & 2 deletions php/tests/api-maps/apiMapsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public function testGetGEOCoordinatesFromAddress_Valid() {
}
else {
$this->assertEquals(2, (is_array($geo_corrds) ? count($geo_corrds) : 0));
$this->assertEquals('54.0873847', $geo_corrds[0]);
$this->assertEquals('-122.5898009', $geo_corrds[1]);
$this->assertEquals('54.0873532', $geo_corrds[0]);
$this->assertEquals('-122.5897507', $geo_corrds[1]);
}
}

Expand Down
15 changes: 10 additions & 5 deletions php/tests/config/configBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

require_once dirname(dirname(__FILE__)).'/baseDBFixture.php';
$rootPath = dirname(dirname(dirname(__FILE__)));
//$rootPath = dirname(dirname(dirname(__FILE__)));

class ConfigBuilderTest extends BaseDBFixture {

Expand All @@ -26,16 +26,19 @@ protected function tearDown(): void {
}

public function testConfigBuilderLoad_ConfigInValid() {
global $rootPath;
// global $rootPath;
try {
$rename_status1 = rename($rootPath.'/config.php', $rootPath.'/config-invalid.php');
$rename_status1 = rename(__RIPRUNNER_ROOT__.'/config.php', __RIPRUNNER_ROOT__.'/config-invalid.php');

//echo '!!!!!!!!!!!!!!!!!!!: '.__RIPRUNNER_ROOT__.'/config-builder.php'.PHP_EOL;
ob_start();
require_once $rootPath.'/config-builder.php';
require_once __RIPRUNNER_ROOT__.'/config-builder.php';
$unit_test_output = ob_get_clean();
$config_exists = file_exists('config.php');
}
finally {
$rename_status2 = rename($rootPath.'/config-invalid.php', $rootPath.'/config.php');
$rename_status2 = rename(__RIPRUNNER_ROOT__.'/config-invalid.php', __RIPRUNNER_ROOT__.'/config.php');
// ob_end_flush();
}

//echo "****** #1 TESTING ***** RENAME: [$rename_status] " . $unit_test_output . PHP_EOL;
Expand All @@ -46,6 +49,8 @@ public function testConfigBuilderLoad_ConfigInValid() {
$this->assertStringContainsString('</html>', $unit_test_output);
$this->assertStringContainsString('Rip Runner Configuration Generator', $unit_test_output);
$this->assertStringContainsString('Generate Configuration', $unit_test_output);


}

}

0 comments on commit 29ce94e

Please sign in to comment.