From ca61224c53f193b4cc3f47dbb99f1197fa865241 Mon Sep 17 00:00:00 2001 From: Piotr Szymaszek Date: Thu, 17 Sep 2020 19:26:08 +0200 Subject: [PATCH 1/3] Updated Codeception, fixed potential missing Data in Image --- composer.json | 6 ++++-- src/Image.php | 5 +---- tests/_output/.gitkeep | 0 3 files changed, 5 insertions(+), 6 deletions(-) delete mode 100644 tests/_output/.gitkeep diff --git a/composer.json b/composer.json index ce94d1b..d5d761f 100644 --- a/composer.json +++ b/composer.json @@ -29,9 +29,11 @@ "ext-gd": "*" }, "require-dev" : { - "codeception/codeception": "^2.4", + "codeception/codeception": "^4.1", "phpunit/phpunit": "^4.8|^7.1", - "squizlabs/php_codesniffer": "^3.4" + "squizlabs/php_codesniffer": "^3.4", + "codeception/module-asserts": "^1.3", + "codeception/module-filesystem": "^1.0" }, "config": { "bin-dir": "vendor/bin" diff --git a/src/Image.php b/src/Image.php index e5e422d..360e682 100644 --- a/src/Image.php +++ b/src/Image.php @@ -34,10 +34,7 @@ public function __construct( $this->TransparentBackground = $TransparentBackground; - if ($DataSet) { - $this->DataSet = $DataSet; - } - + $this->DataSet = null !== $DataSet ? $DataSet : new Data(); $this->XSize = $XSize; $this->YSize = $YSize; $this->Picture = imagecreatetruecolor($XSize, $YSize); diff --git a/tests/_output/.gitkeep b/tests/_output/.gitkeep deleted file mode 100644 index e69de29..0000000 From d7305741d87895a26b420649b0b6c81de73a9175 Mon Sep 17 00:00:00 2001 From: Piotr Szymaszek Date: Thu, 17 Sep 2020 19:28:05 +0200 Subject: [PATCH 2/3] Default value for $FloatingOffset in Draw.php, corrected spline.md --- resources/doc/spline.md | 4 ++-- src/Draw.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/doc/spline.md b/resources/doc/spline.md index de0c541..b80cbe2 100644 --- a/resources/doc/spline.md +++ b/resources/doc/spline.md @@ -10,10 +10,10 @@ use CpChart\Image; // Create and populate data $data = new Data(); -$data->addPoints([], "Serie1") +$data->addPoints([], "Serie1"); // Create the image and set the data -$image = $factory->newImage(700, 230, $data); +$image = new Image(700, 230, $data); $image->setShadow(true, ["X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20]); // 1st spline drawn in white with control points visible diff --git a/src/Draw.php b/src/Draw.php index 7e00a37..c7303b6 100644 --- a/src/Draw.php +++ b/src/Draw.php @@ -2489,6 +2489,7 @@ public function drawLegend($X, $Y, array $Format = []) */ public function drawScale(array $Format = []) { + $FloatingOffset = 0; $Pos = isset($Format["Pos"]) ? $Format["Pos"] : SCALE_POS_LEFTRIGHT; $Floating = isset($Format["Floating"]) ? $Format["Floating"] : false; $Mode = isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING; From ee05ae327d1d77e23a1adf50daf41ea8c33170f7 Mon Sep 17 00:00:00 2001 From: Piotr Szymaszek Date: Thu, 17 Sep 2020 19:40:50 +0200 Subject: [PATCH 3/3] Downgraded Codeception back to 2.x, run PHP 5.6 on prefer-lowest on Travis --- .travis.yml | 3 ++- composer.json | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1445d46..2d6b034 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,9 @@ cache: matrix: include: - - php: 5.5 - php: 5.6 + env: + - COMPOSER_FLAGS='--prefer-lowest' - php: 7.0 - php: 7.1 - php: 7.2 diff --git a/composer.json b/composer.json index d5d761f..ce94d1b 100644 --- a/composer.json +++ b/composer.json @@ -29,11 +29,9 @@ "ext-gd": "*" }, "require-dev" : { - "codeception/codeception": "^4.1", + "codeception/codeception": "^2.4", "phpunit/phpunit": "^4.8|^7.1", - "squizlabs/php_codesniffer": "^3.4", - "codeception/module-asserts": "^1.3", - "codeception/module-filesystem": "^1.0" + "squizlabs/php_codesniffer": "^3.4" }, "config": { "bin-dir": "vendor/bin"