Skip to content

Commit e46bb6e

Browse files
Merge branch '3.4' into 4.3
* 3.4: Fix tests Fix deprecated phpunit annotation
2 parents 0bfae2a + c833d2b commit e46bb6e

17 files changed

+95
-230
lines changed

Tests/Collator/CollatorTest.php

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,30 @@
1111

1212
namespace Symfony\Component\Intl\Tests\Collator;
1313

14+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1415
use Symfony\Component\Intl\Collator\Collator;
1516
use Symfony\Component\Intl\Globals\IntlGlobals;
1617

1718
class CollatorTest extends AbstractCollatorTest
1819
{
19-
/**
20-
* @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
21-
*/
20+
use ForwardCompatTestTrait;
21+
2222
public function testConstructorWithUnsupportedLocale()
2323
{
24+
$this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
2425
new Collator('pt_BR');
2526
}
2627

27-
/**
28-
* @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
29-
*/
3028
public function testCompare()
3129
{
30+
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
3231
$collator = $this->getCollator('en');
3332
$collator->compare('a', 'b');
3433
}
3534

36-
/**
37-
* @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
38-
*/
3935
public function testGetAttribute()
4036
{
37+
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
4138
$collator = $this->getCollator('en');
4239
$collator->getAttribute(Collator::NUMERIC_COLLATION);
4340
}
@@ -66,38 +63,30 @@ public function testConstructWithoutLocale()
6663
$this->assertInstanceOf('\Symfony\Component\Intl\Collator\Collator', $collator);
6764
}
6865

69-
/**
70-
* @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
71-
*/
7266
public function testGetSortKey()
7367
{
68+
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
7469
$collator = $this->getCollator('en');
7570
$collator->getSortKey('Hello');
7671
}
7772

78-
/**
79-
* @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
80-
*/
8173
public function testGetStrength()
8274
{
75+
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
8376
$collator = $this->getCollator('en');
8477
$collator->getStrength();
8578
}
8679

87-
/**
88-
* @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
89-
*/
9080
public function testSetAttribute()
9181
{
82+
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
9283
$collator = $this->getCollator('en');
9384
$collator->setAttribute(Collator::NUMERIC_COLLATION, Collator::ON);
9485
}
9586

96-
/**
97-
* @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException
98-
*/
9987
public function testSetStrength()
10088
{
89+
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
10190
$collator = $this->getCollator('en');
10291
$collator->setStrength(Collator::PRIMARY);
10392
}

Tests/CountriesTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,9 @@ public function testLocaleAliasesAreLoaded()
337337
$this->assertNotSame($countryNameZh, $countryNameZhTw, 'zh_TW does not fall back to zh');
338338
}
339339

340-
/**
341-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
342-
*/
343340
public function testGetNameWithInvalidCountryCode()
344341
{
342+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
345343
Countries::getName('foo');
346344
}
347345

Tests/CurrenciesTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,10 +725,10 @@ function ($value) { return [$value]; },
725725

726726
/**
727727
* @dataProvider provideCurrenciesWithoutNumericEquivalent
728-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
729728
*/
730729
public function testGetNumericCodeFailsIfNoNumericEquivalent($currency)
731730
{
731+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
732732
Currencies::getNumericCode($currency);
733733
}
734734

@@ -770,18 +770,16 @@ function ($value) { return [$value]; },
770770

771771
/**
772772
* @dataProvider provideInvalidNumericCodes
773-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
774773
*/
775774
public function testForNumericCodeFailsIfInvalidNumericCode($currency)
776775
{
776+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
777777
Currencies::forNumericCode($currency);
778778
}
779779

780-
/**
781-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
782-
*/
783780
public function testGetNameWithInvalidCurrencyCode()
784781
{
782+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
785783
Currencies::getName('foo');
786784
}
787785

Tests/Data/Bundle/Reader/BundleEntryReaderTest.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,9 @@ public function testReadExistingEntry()
105105
$this->assertSame('Bar', $this->reader->readEntry(self::RES_DIR, 'root', ['Entries', 'Foo']));
106106
}
107107

108-
/**
109-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
110-
*/
111108
public function testReadNonExistingEntry()
112109
{
110+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
113111
$this->readerImpl->expects($this->once())
114112
->method('read')
115113
->with(self::RES_DIR, 'root')
@@ -133,11 +131,9 @@ public function testFallbackIfEntryDoesNotExist()
133131
$this->assertSame('Lah', $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Entries', 'Bam']));
134132
}
135133

136-
/**
137-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
138-
*/
139134
public function testDontFallbackIfEntryDoesNotExistAndFallbackDisabled()
140135
{
136+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
141137
$this->readerImpl->expects($this->once())
142138
->method('read')
143139
->with(self::RES_DIR, 'en_GB')
@@ -161,11 +157,9 @@ public function testFallbackIfLocaleDoesNotExist()
161157
$this->assertSame('Lah', $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Entries', 'Bam']));
162158
}
163159

164-
/**
165-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
166-
*/
167160
public function testDontFallbackIfLocaleDoesNotExistAndFallbackDisabled()
168161
{
162+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
169163
$this->readerImpl->expects($this->once())
170164
->method('read')
171165
->with(self::RES_DIR, 'en_GB')
@@ -293,11 +287,9 @@ public function testMergeExistingEntryWithNonExistingFallbackEntry($childData, $
293287
$this->assertSame($childData, $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Foo', 'Bar'], true));
294288
}
295289

296-
/**
297-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
298-
*/
299290
public function testFailIfEntryFoundNeitherInParentNorChild()
300291
{
292+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
301293
$this->readerImpl->expects($this->at(0))
302294
->method('read')
303295
->with(self::RES_DIR, 'en_GB')

Tests/Data/Bundle/Reader/IntlBundleReaderTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,21 @@ public function testReadDoesNotFollowFallbackAlias()
7676
$this->assertArrayNotHasKey('ExistsNot', $data);
7777
}
7878

79-
/**
80-
* @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
81-
*/
8279
public function testReadFailsIfNonExistingLocale()
8380
{
81+
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
8482
$this->reader->read(__DIR__.'/Fixtures/res', 'foo');
8583
}
8684

87-
/**
88-
* @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
89-
*/
9085
public function testReadFailsIfNonExistingFallbackLocale()
9186
{
87+
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
9288
$this->reader->read(__DIR__.'/Fixtures/res', 'ro_AT');
9389
}
9490

95-
/**
96-
* @expectedException \Symfony\Component\Intl\Exception\RuntimeException
97-
*/
9891
public function testReadFailsIfNonExistingDirectory()
9992
{
93+
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
10094
$this->reader->read(__DIR__.'/foo', 'ro');
10195
}
10296
}

Tests/Data/Bundle/Reader/JsonBundleReaderTest.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,43 +41,33 @@ public function testReadReturnsArray()
4141
$this->assertArrayNotHasKey('ExistsNot', $data);
4242
}
4343

44-
/**
45-
* @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
46-
*/
4744
public function testReadFailsIfNonExistingLocale()
4845
{
46+
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
4947
$this->reader->read(__DIR__.'/Fixtures/json', 'foo');
5048
}
5149

52-
/**
53-
* @expectedException \Symfony\Component\Intl\Exception\RuntimeException
54-
*/
5550
public function testReadFailsIfNonExistingDirectory()
5651
{
52+
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
5753
$this->reader->read(__DIR__.'/foo', 'en');
5854
}
5955

60-
/**
61-
* @expectedException \Symfony\Component\Intl\Exception\RuntimeException
62-
*/
6356
public function testReadFailsIfNotAFile()
6457
{
58+
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
6559
$this->reader->read(__DIR__.'/Fixtures/NotAFile', 'en');
6660
}
6761

68-
/**
69-
* @expectedException \Symfony\Component\Intl\Exception\RuntimeException
70-
*/
7162
public function testReadFailsIfInvalidJson()
7263
{
64+
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
7365
$this->reader->read(__DIR__.'/Fixtures/json', 'en_Invalid');
7466
}
7567

76-
/**
77-
* @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
78-
*/
7968
public function testReaderDoesNotBreakOutOfGivenPath()
8069
{
70+
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
8171
$this->reader->read(__DIR__.'/Fixtures/json', '../invalid_directory/en');
8272
}
8373
}

Tests/Data/Bundle/Reader/PhpBundleReaderTest.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,35 +41,27 @@ public function testReadReturnsArray()
4141
$this->assertArrayNotHasKey('ExistsNot', $data);
4242
}
4343

44-
/**
45-
* @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
46-
*/
4744
public function testReadFailsIfNonExistingLocale()
4845
{
46+
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
4947
$this->reader->read(__DIR__.'/Fixtures/php', 'foo');
5048
}
5149

52-
/**
53-
* @expectedException \Symfony\Component\Intl\Exception\RuntimeException
54-
*/
5550
public function testReadFailsIfNonExistingDirectory()
5651
{
52+
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
5753
$this->reader->read(__DIR__.'/foo', 'en');
5854
}
5955

60-
/**
61-
* @expectedException \Symfony\Component\Intl\Exception\RuntimeException
62-
*/
6356
public function testReadFailsIfNotAFile()
6457
{
58+
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
6559
$this->reader->read(__DIR__.'/Fixtures/NotAFile', 'en');
6660
}
6761

68-
/**
69-
* @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
70-
*/
7162
public function testReaderDoesNotBreakOutOfGivenPath()
7263
{
64+
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
7365
$this->reader->read(__DIR__.'/Fixtures/php', '../invalid_directory/en');
7466
}
7567
}

Tests/Data/Provider/AbstractCurrencyDataProviderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,10 @@ function ($value) { return [$value]; },
748748

749749
/**
750750
* @dataProvider provideCurrenciesWithoutNumericEquivalent
751-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
752751
*/
753752
public function testGetNumericCodeFailsIfNoNumericEquivalent($currency)
754753
{
754+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
755755
$this->dataProvider->getNumericCode($currency);
756756
}
757757

@@ -793,10 +793,10 @@ function ($value) { return [$value]; },
793793

794794
/**
795795
* @dataProvider provideInvalidNumericCodes
796-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
797796
*/
798797
public function testForNumericCodeFailsIfInvalidNumericCode($currency)
799798
{
799+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
800800
$this->dataProvider->forNumericCode($currency);
801801
}
802802

Tests/Data/Provider/AbstractLanguageDataProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,10 +937,10 @@ function ($value) { return [$value]; },
937937

938938
/**
939939
* @dataProvider provideLanguagesWithoutAlpha3Equivalent
940-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
941940
*/
942941
public function testGetAlpha3CodeFailsIfNoAlpha3Equivalent($currency)
943942
{
943+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
944944
$this->dataProvider->getAlpha3Code($currency);
945945
}
946946
}

Tests/Data/Util/RingBufferTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,9 @@ public function testWritePastBuffer()
5555
$this->assertSame('bam', $this->buffer[2]);
5656
}
5757

58-
/**
59-
* @expectedException \Symfony\Component\Intl\Exception\OutOfBoundsException
60-
*/
6158
public function testReadNonExistingFails()
6259
{
60+
$this->expectException('Symfony\Component\Intl\Exception\OutOfBoundsException');
6361
$this->buffer['foo'];
6462
}
6563

@@ -75,11 +73,9 @@ public function testUnsetNonExistingSucceeds()
7573
$this->assertArrayNotHasKey('foo', $this->buffer);
7674
}
7775

78-
/**
79-
* @expectedException \Symfony\Component\Intl\Exception\OutOfBoundsException
80-
*/
8176
public function testReadOverwrittenFails()
8277
{
78+
$this->expectException('Symfony\Component\Intl\Exception\OutOfBoundsException');
8379
$this->buffer[0] = 'foo';
8480
$this->buffer['bar'] = 'baz';
8581
$this->buffer[2] = 'bam';

0 commit comments

Comments
 (0)