Skip to content

Commit

Permalink
Merge pull request #8 from duboism/fix_autoload
Browse files Browse the repository at this point in the history
Allow to run the test suite without composer install
  • Loading branch information
ashnazg authored Jan 4, 2025
2 parents 060450d + 7107970 commit e8840c0
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 9 deletions.
8 changes: 7 additions & 1 deletion tests/gradients.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
* @link http://pear.php.net/package/Image_Canvas
*/

require_once 'vendor/autoload.php';
if (file_exists('vendor/autoload.php')) {
// use composer if available
require_once 'vendor/autoload.php';
} else {
// otherwise rely on classic PEAR include_path
require_once 'Image/Canvas.php';
}

$canvas =& Image_Canvas::factory(
'png',
Expand Down
9 changes: 8 additions & 1 deletion tests/imagemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@
* @link http://pear.php.net/package/Image_Canvas
*/

require_once 'vendor/autoload.php';

if (file_exists('vendor/autoload.php')) {
// use composer if available
require_once 'vendor/autoload.php';
} else {
// otherwise rely on classic PEAR include_path
require_once 'Image/Canvas.php';
}

$canvas =& Image_Canvas::factory(
'png',
Expand Down
8 changes: 7 additions & 1 deletion tests/jpg.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
// SPECIFY HERE WHERE A TRUETYPE FONT CAN BE FOUND
$testFont = 'c:/windows/fonts/Arial.ttf';

require_once 'vendor/autoload.php';
if (file_exists('vendor/autoload.php')) {
// use composer if available
require_once 'vendor/autoload.php';
} else {
// otherwise rely on classic PEAR include_path
require_once 'Image/Canvas.php';
}

$canvas =& Image_Canvas::factory('jpg', array('width' => 600, 'height' => 600, 'quality' => 90));

Expand Down
8 changes: 7 additions & 1 deletion tests/lineends.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
* @link http://pear.php.net/package/Image_Canvas
*/

require_once 'vendor/autoload.php';
if (file_exists('vendor/autoload.php')) {
// use composer if available
require_once 'vendor/autoload.php';
} else {
// otherwise rely on classic PEAR include_path
require_once 'Image/Canvas.php';
}

$font = array('name' => 'Verdana', 'size' => 10);

Expand Down
8 changes: 7 additions & 1 deletion tests/pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
// SPECIFY HERE WHERE A TRUETYPE FONT CAN BE FOUND
$testFont = 'c:/windows/fonts/Arial.ttf';

require_once 'vendor/autoload.php';
if (file_exists('vendor/autoload.php')) {
// use composer if available
require_once 'vendor/autoload.php';
} else {
// otherwise rely on classic PEAR include_path
require_once 'Image/Canvas.php';
}

$canvas =& Image_Canvas::factory('pdf', array('page' => 'A4', 'align' => 'center', 'width' => 600, 'height' => 600));

Expand Down
8 changes: 7 additions & 1 deletion tests/png.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
// SPECIFY HERE WHERE A TRUETYPE FONT CAN BE FOUND
$testFont = 'c:/windows/fonts/Arial.ttf';

require_once 'vendor/autoload.php';
if (file_exists('vendor/autoload.php')) {
// use composer if available
require_once 'vendor/autoload.php';
} else {
// otherwise rely on classic PEAR include_path
require_once 'Image/Canvas.php';
}

$canvas =& Image_Canvas::factory('png', array('width' => 600, 'height' => 600));

Expand Down
8 changes: 7 additions & 1 deletion tests/ps.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
// SPECIFY HERE WHERE A TRUETYPE FONT CAN BE FOUND
$testFont = 'c:/windows/fonts/Arial.ttf';

require_once 'vendor/autoload.php';
if (file_exists('vendor/autoload.php')) {
// use composer if available
require_once 'vendor/autoload.php';
} else {
// otherwise rely on classic PEAR include_path
require_once 'Image/Canvas.php';
}

$canvas =& Image_Canvas::factory('ps', array('page' => 'A4', 'align' => 'center', 'width' => 600, 'height' => 600, 'filename'=>'testps.ps'));

Expand Down
8 changes: 7 additions & 1 deletion tests/svg.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
// SPECIFY HERE WHERE A TRUETYPE FONT CAN BE FOUND
$testFont = 'c:/windows/fonts/Arial.ttf';

require_once 'vendor/autoload.php';
if (file_exists('vendor/autoload.php')) {
// use composer if available
require_once 'vendor/autoload.php';
} else {
// otherwise rely on classic PEAR include_path
require_once 'Image/Canvas.php';
}

$canvas =& Image_Canvas::factory('svg', array('width' => 600, 'height' => 600));

Expand Down
8 changes: 7 additions & 1 deletion tests/text.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
* @link http://pear.php.net/package/Image_Canvas
*/

require_once 'vendor/autoload.php';
if (file_exists('vendor/autoload.php')) {
// use composer if available
require_once 'vendor/autoload.php';
} else {
// otherwise rely on classic PEAR include_path
require_once 'Image/Canvas.php';
}

$canvas =& Image_Canvas::factory(
'png',
Expand Down

0 comments on commit e8840c0

Please sign in to comment.