From e6db788e30463c7181e69beda8d141f43900454a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 25 May 2011 23:34:20 +0000 Subject: [PATCH] Test cases for bug 27465: problems with XML namespace handling break SVGMetadataExtractor::getMetadata() $ php phpunit.php includes/media/SVGMetadataExtractorTest.php PHPUnit 3.5.13 by Sebastian Bergmann. ..E Time: 1 second, Memory: 14.00Mb There was 1 error: 1) SVGMetadataExtractorTest::testGetMetadata with data set #2 ('/var/www/trunk/tests/phpunit/includes/media/US_states_by_total_state_tax_revenue.svg', array(593, 959)) MWException: Expected tag, got ns0:svg /var/www/trunk/includes/media/SVGMetadataExtractor.php:105 /var/www/trunk/includes/media/SVGMetadataExtractor.php:78 /var/www/trunk/includes/media/SVGMetadataExtractor.php:30 /var/www/trunk/tests/phpunit/includes/media/SVGMetadataExtractorTest.php:14 /var/www/trunk/tests/phpunit/MediaWikiTestCase.php:63 /var/www/trunk/tests/phpunit/MediaWikiPHPUnitCommand.php:20 /var/www/trunk/tests/phpunit/phpunit.php:60 FAILURES! Tests: 3, Assertions: 2, Errors: 1. --- .../includes/media/Gtk-media-play-ltr.svg | 35 +++ tests/phpunit/includes/media/QA_icon.svg | 77 ++++++ tests/phpunit/includes/media/README | 16 ++ .../media/SVGMetadataExtractorTest.php | 52 ++++ .../US_states_by_total_state_tax_revenue.svg | 248 ++++++++++++++++++ 5 files changed, 428 insertions(+) create mode 100644 tests/phpunit/includes/media/Gtk-media-play-ltr.svg create mode 100644 tests/phpunit/includes/media/QA_icon.svg create mode 100644 tests/phpunit/includes/media/README create mode 100644 tests/phpunit/includes/media/SVGMetadataExtractorTest.php create mode 100644 tests/phpunit/includes/media/US_states_by_total_state_tax_revenue.svg diff --git a/tests/phpunit/includes/media/Gtk-media-play-ltr.svg b/tests/phpunit/includes/media/Gtk-media-play-ltr.svg new file mode 100644 index 0000000000..fc22338a5a --- /dev/null +++ b/tests/phpunit/includes/media/Gtk-media-play-ltr.svg @@ -0,0 +1,35 @@ + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/phpunit/includes/media/QA_icon.svg b/tests/phpunit/includes/media/QA_icon.svg new file mode 100644 index 0000000000..6b5d86e490 --- /dev/null +++ b/tests/phpunit/includes/media/QA_icon.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ? + + + + + + + + \ No newline at end of file diff --git a/tests/phpunit/includes/media/README b/tests/phpunit/includes/media/README new file mode 100644 index 0000000000..cbed0ac368 --- /dev/null +++ b/tests/phpunit/includes/media/README @@ -0,0 +1,16 @@ +QA_icon.svg: +http://es.wikipedia.org/wiki/Archivo:QA_icon.svg +GNU Lesser General Public License +~~helix84 (16.4.2007), Philverney (6.12.2005) David Vignoni + +Gtk-media-play-ltr.svg +http://commons.wikimedia.org/wiki/File:Gtk-media-play-ltr.svg +GNU Lesser General Public License +http://ftp.gnome.org/pub/GNOME/sources/gnome-themes-extras/0.9/gnome-themes-extras-0.9.0.tar.gz +David Vignoni + +US_states_by_total_state_tax_revenue.svg +http://commons.wikimedia.org/wiki/File:US_states_by_total_state_tax_revenue.svg +CC-BY 3.0 +TastyCakes on English Wikipedia + diff --git a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php new file mode 100644 index 0000000000..0c2363a0e5 --- /dev/null +++ b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php @@ -0,0 +1,52 @@ +assertEquals( $expected, $data, 'SVG metadata extraction test' ); + } catch ( MWException $e ) { + if ( $expected === false ) { + $this->assertTrue( true, 'SVG metadata extracted test (expected failure)' ); + } else { + throw $e; + } + } + } + + function providerSvgFiles() { + $base = dirname( __FILE__ ); + return array( + array( + "$base/QA_icon.svg", + array( + 'width' => 60, + 'height' => 60 + ) + ), + array( + "$base/Gtk-media-play-ltr.svg", + array( + 'width' => 60, + 'height' => 60 + ) + ), + array( + "$base/US_states_by_total_state_tax_revenue.svg", + array( + 'width' => 593, + 'height' => 959 + ) + ), + ); + } +} + diff --git a/tests/phpunit/includes/media/US_states_by_total_state_tax_revenue.svg b/tests/phpunit/includes/media/US_states_by_total_state_tax_revenue.svg new file mode 100644 index 0000000000..2df5cec4bf --- /dev/null +++ b/tests/phpunit/includes/media/US_states_by_total_state_tax_revenue.svg @@ -0,0 +1,248 @@ + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 2.20.1