Remove some constant definition from test/bootstrap-dist.php

Fix some failing tests.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2021-06-04 00:18:09 -03:00
parent 3f9265b48f
commit f63d21b65b
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
10 changed files with 28 additions and 27 deletions

View File

@ -5,6 +5,11 @@
colors="true"
verbose="true">
<php>
<const name="PHPMYADMIN" value="1"/>
<const name="TESTSUITE" value="1"/>
</php>
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">test/classes</directory>

View File

@ -1,7 +1,4 @@
<?php
/**
* Bootstrap for phpMyAdmin tests
*/
declare(strict_types=1);
@ -24,19 +21,4 @@ error_reporting(E_ALL);
// Ensure PHP has set timezone
date_default_timezone_set('UTC');
// Adding phpMyAdmin sources to include path
set_include_path(
get_include_path() . PATH_SEPARATOR . dirname((string) realpath('../index.php'))
);
// Setting constants for testing
// phpcs:disable PSR1.Files.SideEffects
if (! defined('PHPMYADMIN')) {
define('PHPMYADMIN', 1);
define('TESTSUITE', 1);
}
// phpcs:enable
require_once ROOT_PATH . 'libraries/vendor_config.php';
require_once AUTOLOAD_FILE;

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers;
use PhpMyAdmin\Config;
use PhpMyAdmin\Controllers\ExportTemplateController;
use PhpMyAdmin\Export\Template as ExportTemplate;
use PhpMyAdmin\Export\TemplateModel;

View File

@ -181,13 +181,15 @@ class GisGeometryCollectionTest extends AbstractTestCase
$this->markTestSkipped('GD extension missing!');
}
$image = imagecreatetruecolor(120, 150);
$this->assertNotFalse($image);
$return = $this->object->prepareRowAsPng(
'GEOMETRYCOLLECTION(POLYGON((35 10,10 20,15 40,45 45,35 10),'
. '(20 30,35 32,30 20,20 30)))',
'image',
'#B02EE0',
['x' => 12, 'y' => 69, 'scale' => 2, 'height' => 150],
imagecreatetruecolor(120, 150)
$image
);
$this->assertEquals(120, imagesx($return));
$this->assertEquals(150, imagesy($return));

View File

@ -174,12 +174,14 @@ class GisLineStringTest extends GisGeomTestCase
$this->markTestSkipped('GD extension missing!');
}
$image = imagecreatetruecolor(120, 150);
$this->assertNotFalse($image);
$return = $this->object->prepareRowAsPng(
'LINESTRING(12 35,48 75,69 23,25 45,14 53,35 78)',
'image',
'#B02EE0',
['x' => 12, 'y' => 69, 'scale' => 2, 'height' => 150],
imagecreatetruecolor(120, 150)
$image
);
$this->assertImage($return);
}

View File

@ -256,12 +256,14 @@ class GisMultiLineStringTest extends GisGeomTestCase
$this->markTestSkipped('GD extension missing!');
}
$image = imagecreatetruecolor(120, 150);
$this->assertNotFalse($image);
$return = $this->object->prepareRowAsPng(
'MULTILINESTRING((36 14,47 23,62 75),(36 10,17 23,178 53))',
'image',
'#B02EE0',
['x' => 12, 'y' => 69, 'scale' => 2, 'height' => 150],
imagecreatetruecolor(120, 150)
$image
);
$this->assertImage($return);
}

View File

@ -176,12 +176,14 @@ class GisMultiPointTest extends GisGeomTestCase
$this->markTestSkipped('GD extension missing!');
}
$image = imagecreatetruecolor(120, 150);
$this->assertNotFalse($image);
$return = $this->object->prepareRowAsPng(
'MULTIPOINT(12 35,48 75,69 23,25 45,14 53,35 78)',
'image',
'#B02EE0',
['x' => 12, 'y' => 69, 'scale' => 2, 'height' => 150],
imagecreatetruecolor(120, 150)
$image
);
$this->assertImage($return);
}

View File

@ -343,13 +343,15 @@ class GisMultiPolygonTest extends GisGeomTestCase
$this->markTestSkipped('GD extension missing!');
}
$image = imagecreatetruecolor(120, 150);
$this->assertNotFalse($image);
$return = $this->object->prepareRowAsPng(
'MULTIPOLYGON(((136 40,147 83,16 75,136 40)),'
. '((105 0,56 20,78 73,105 0)))',
'image',
'#B02EE0',
['x' => 12, 'y' => 69, 'scale' => 2, 'height' => 150],
imagecreatetruecolor(120, 150)
$image
);
$this->assertImage($return);
}

View File

@ -185,17 +185,20 @@ class GisPointTest extends GisGeomTestCase
];
}
public function testPrepareRowAsPng(): void {
public function testPrepareRowAsPng(): void
{
if (! function_exists('imagecreatetruecolor')) {
$this->markTestSkipped('GD extension missing!');
}
$image = imagecreatetruecolor(120, 150);
$this->assertNotFalse($image);
$return = $this->object->prepareRowAsPng(
'POINT(12 35)',
'image',
'#B02EE0',
['x' => 12, 'y' => 69, 'scale' => 2, 'height' => 150],
imagecreatetruecolor(120, 150)
$image
);
$this->assertImage($return);
}

View File

@ -433,12 +433,14 @@ class GisPolygonTest extends GisGeomTestCase
$this->markTestSkipped('GD extension missing!');
}
$image = imagecreatetruecolor(120, 150);
$this->assertNotFalse($image);
$return = $this->object->prepareRowAsPng(
'POLYGON((123 0,23 30,17 63,123 0))',
'image',
'#B02EE0',
['x' => 12, 'y' => 69, 'scale' => 2, 'height' => 150],
imagecreatetruecolor(120, 150)
$image
);
$this->assertImage($return);
}