Skip to content

Commit d8bc9bf

Browse files
committed
Test saving images without extension
1 parent 3db069b commit d8bc9bf

File tree

3 files changed

+25
-77
lines changed

3 files changed

+25
-77
lines changed

.travis.yml

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ script:
4343
composer --no-interaction codestyle -- --no-interaction --dry-run --diff -- .
4444
;;
4545
*)
46-
composer --no-interaction test -- --exclude-group "${PHPUNIT_EXCLUDED_GROUPS}"
46+
composer --no-interaction test -- --exclude-group "${PHPUNIT_EXCLUDED_GROUPS}" --filter=testSaveWithoutFileExtension
4747
;;
4848
esac
4949
- if test -n "${AUTOUPDATE_API:-}"; then ./.travis/autoupdate-api.sh; fi
@@ -53,68 +53,8 @@ matrix:
5353
allow_failures:
5454
- name: Test with PHP nightly (all drivers)
5555
include:
56-
-
57-
name: Test with PHP 5.3 (GD and imagick drivers)
58-
dist: precise
59-
php: '5.3'
60-
env:
61-
- IMAGINE_DRIVER: imagick
62-
-
63-
name: Test with PHP 5.3 (GD and gmagick drivers)
64-
dist: precise
65-
php: '5.3'
66-
env:
67-
- IMAGINE_DRIVER: gmagick
68-
-
69-
name: Test with PHP 5.4 (all drivers)
70-
dist: trusty
71-
php: '5.4'
72-
env:
73-
- IMAGINE_DRIVER: all
74-
-
75-
name: Test with PHP 5.5 (all drivers)
76-
dist: trusty
77-
php: '5.5'
78-
env:
79-
- IMAGINE_DRIVER: all
80-
-
81-
name: Test with PHP 5.6 (all drivers)
82-
php: '5.6'
83-
env:
84-
- IMAGINE_DRIVER: all
85-
-
86-
name: Test with PHP 7.0 (all drivers)
87-
php: '7.0'
88-
env:
89-
- IMAGINE_DRIVER: all
90-
-
91-
name: Test with PHP 7.1 (all drivers)
92-
php: '7.1'
93-
env:
94-
- IMAGINE_DRIVER: all
95-
-
96-
name: Test with PHP 7.2 (all drivers)
97-
php: '7.2'
98-
env:
99-
- IMAGINE_DRIVER: all
10056
-
10157
name: Test with PHP 7.3 (all drivers)
10258
php: '7.3'
10359
env:
104-
- IMAGINE_DRIVER: all
105-
-
106-
name: Test with PHP 7.4 (all drivers)
107-
php: '7.4'
108-
env:
109-
- IMAGINE_DRIVER: all
110-
-
111-
name: Test with PHP nightly (all drivers)
112-
php: nightly
113-
env:
114-
- IMAGINE_DRIVER: all
115-
-
116-
name: Coding style and docs
117-
php: 7.2
118-
env:
119-
- TRAVISOPERATION=codestyle
120-
- AUTOUPDATE_API=yes
60+
- IMAGINE_DRIVER: gmagick

.travis/gmagick.sh

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -xe
44

5-
GRAPHICSMAGIC_VERSION='1.3.23'
5+
GRAPHICSMAGIC_VERSION='1.3.30'
66
if [ ${TRAVIS_PHP_VERSION:0:1} = '5' ]; then
77
GMAGICK_VERSION='1.1.7RC2'
88
else
@@ -15,20 +15,9 @@ CUSTOM_CFLAGS='-Wno-misleading-indentation -Wno-unused-const-variable -Wno-point
1515
mkdir -p cache
1616
cd cache
1717

18-
if [ ! -e ./GraphicsMagick-$GRAPHICSMAGIC_VERSION ]; then
19-
rm -rf ./GraphicsMagick-* || true
20-
wget http://78.108.103.11/MIRROR/ftp/GraphicsMagick/1.3/GraphicsMagick-$GRAPHICSMAGIC_VERSION.tar.xz
21-
tar -xf GraphicsMagick-$GRAPHICSMAGIC_VERSION.tar.xz
22-
rm GraphicsMagick-$GRAPHICSMAGIC_VERSION.tar.xz
23-
cd GraphicsMagick-$GRAPHICSMAGIC_VERSION
24-
CFLAGS="${CFLAGS:-} ${CUSTOM_CFLAGS:-}" ./configure --prefix=/opt/gmagick --enable-shared --with-lcms2
25-
make -j V=0
26-
else
27-
cd GraphicsMagick-$GRAPHICSMAGIC_VERSION
28-
fi
29-
30-
sudo make install
31-
cd ..
18+
sudo add-apt-repository -y ppa:ondrej/php
19+
sudo apt-get -q update
20+
sudo apt-get -y install graphicsmagick graphicsmagick-dbg libgraphicsmagick1-dev
3221

3322
if [ ! -e ./gmagick-$GMAGICK_VERSION-$PHP_VERSION-$GRAPHICSMAGIC_VERSION ]; then
3423
rm -rf ./gmagick-* || true

tests/tests/Image/AbstractImageTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,25 @@ public function testInOutResult($file, $in, $out)
585585
$thumb->save($filename);
586586
}
587587

588+
/**
589+
* @dataProvider inOutResultProvider
590+
*
591+
* @param string $file
592+
* @param string $in
593+
* @param string $out
594+
*/
595+
public function testSaveWithoutFileExtension($file, $in, $out)
596+
{
597+
$factory = $this->getImagine();
598+
$image = $factory->open(IMAGINE_TEST_FIXTURESFOLDER . "/{$file}.{$in}");
599+
$thumb = $image->thumbnail(new Box(50, 50), ImageInterface::THUMBNAIL_OUTBOUND);
600+
$filename = $this->getTemporaryFilename(md5("{$file}-{$in}-{$out}"));
601+
$thumb->save($filename, array('format' => $out));
602+
$imageType = getimagesize($filename);
603+
$imageType = str_replace('jpeg', 'jpg', substr($imageType['mime'], 6));
604+
$this->assertSame($out, $imageType);
605+
}
606+
588607
public function testLayerReturnsALayerInterface()
589608
{
590609
$factory = $this->getImagine();

0 commit comments

Comments
 (0)