Permalink
Browse files

Move travis environment setup logic to travis configuration file

  • Loading branch information...
romainneutron committed Jul 18, 2013
1 parent e7bb709 commit 63438120c3589c2a8da76ab5c4db1ec37aceaa41
View
@@ -5,4 +5,4 @@ Imagine-*.tgz
imagine-*.phar
composer.phar
vendor/
-bin/
+bin/
View
@@ -1,10 +1,50 @@
language: php
+
+env:
+ - IMAGINE_DRIVER=imagick
+ - IMAGINE_DRIVER=gmagick
+
before_script:
- composer self-update
- - composer install --prefer-source
+ - composer install --prefer-source
+ - sudo apt-get remove -y imagemagick libmagickcore-dev libmagickwand-dev
+ - sudo apt-get install -y libtiff-dev libjpeg-dev libdjvulibre-dev libwmf-dev pkg-config
+ - echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
+ - sh -c " if [ '$IMAGINE_DRIVER' = 'imagick' ]; then
+ wget http://www.imagemagick.org/download/legacy/ImageMagick-6.8.5-10.tar.gz;
+ tar xzf ImageMagick-6.8.5-10.tar.gz;
+ cd ImageMagick-6.8.5-10;
+ ./configure --prefix=/opt/imagemagick;
+ make -j;
+ sudo make install;
+ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/imagemagick/lib/pkgconfig;
+ sudo ln -s /opt/imagemagick/include/ImageMagick-6 /opt/imagemagick/include/ImageMagick;
+ cd ..;
+ wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz;
+ tar -xzf imagick-3.1.0RC2.tgz;
+ cd imagick-3.1.0RC2;
+ phpize;
+ ./configure --with-imagick=/opt/imagemagick;
+ make -j;
+ sudo make install;
+ echo \"extension=imagick.so\" >> `php --ini | grep \"Loaded Configuration\" | sed -e \"s|.*:\s*||\"`;
+ php --ri imagick;
+ fi"
+ - sh -c " if [ '$IMAGINE_DRIVER' = 'gmagick' ]; then
+ sudo apt-get install -y graphicsmagick libgraphicsmagick1-dev;
+ wget http://pecl.php.net/get/gmagick-1.1.0RC3.tgz;
+ tar -xzf gmagick-1.1.0RC3.tgz;
+ cd gmagick-1.1.0RC3;
+ phpize;
+ ./configure --with-gmagick=/usr/local;
+ make -j;
+ sudo make install;
+ echo \"extension=gmagick.so\" >> `php --ini | grep \"Loaded Configuration\" | sed -e \"s|.*:\s*||\"`;
+ php --ri gmagick;
+ fi"
+
php:
- 5.3.3
- 5.3
- 5.4
- 5.5
-script: rake test
View
@@ -51,24 +51,6 @@ end
task :test do
exitcode = 0
- if ENV["TRAVIS"] == 'true'
- puts "Travis CI"
- system "sudo apt-get install -ylibtiff-dev libjpeg-dev libdjvulibre-dev libwmf-dev"
-
- system "wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz"
- system "tar -xzf imagick-3.1.0RC2.tgz"
- system "sh -c \"cd imagick-3.1.0RC2 && phpize && ./configure --with-imagick=/usr/local && make -j && sudo make install\""
-
- system "sudo apt-get install -y graphicsmagick libgraphicsmagick1-dev"
-
- system "wget http://pecl.php.net/get/gmagick-1.1.0RC3.tgz"
- system "tar -xzf gmagick-1.1.0RC3.tgz"
- system "sh -c \"cd gmagick-1.1.0RC3 && phpize && ./configure --with-gmagick=/usr/local && make -j && sudo make install\""
-
- system "wget http://www.imagemagick.org/download/legacy/ImageMagick-6.8.5-10.tar.gz"
- system "sh -c \"tar xzf ImageMagick-6.8.5-10.tar.gz && cd ImageMagick-6.8.5-10 && ./configure && make -j && sudo make install\""
- end
-
ini_file = Hash[`php --ini`.split("\n").map {|l| l.split(/:\s+/)}]["Loaded Configuration File"]
original_ini_contents = File.read(ini_file)
@@ -59,18 +59,28 @@ public function testGrayscale()
$pixel = $image->getColorAt(new Point(10, 10));
- $this->assertEquals('#565656', (string) $pixel);
+ $this->assertEquals($this->getGrayValue(), (string) $pixel);
$greyR = (int) $pixel->getRed();
$greyG = (int) $pixel->getGreen();
$greyB = (int) $pixel->getBlue();
- $this->assertEquals($greyR, (int) 86);
+ $this->assertEquals($greyR, $this->getComponentGrayValue());
$this->assertEquals($greyR, $greyG);
$this->assertEquals($greyR, $greyB);
$this->assertEquals($greyG, $greyB);
}
+ protected function getGrayValue()
+ {
+ return '#565656';
+ }
+
+ protected function getComponentGrayValue()
+ {
+ return 86;
+ }
+
public function testColorize()
{
$imagine = $this->getImagine();
@@ -29,4 +29,14 @@ protected function getImagine()
{
return new Imagine();
}
+
+ protected function getGrayValue()
+ {
+ return '#555555';
+ }
+
+ protected function getComponentGrayValue()
+ {
+ return 85;
+ }
}
@@ -28,7 +28,7 @@ protected function setUp()
protected function getEstimatedFontBox()
{
- return new Box(115, 55);
+ return new Box(117, 55);
}
protected function getImagine()

0 comments on commit 6343812

Please sign in to comment.