Skip to content

Commit c833d2b

Browse files
committed
Fix deprecated phpunit annotation
1 parent 11bfea7 commit c833d2b

11 files changed

+80
-192
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/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
@@ -84,27 +84,21 @@ public function testReadDoesNotFollowFallbackAlias()
8484
$this->assertArrayNotHasKey('ExistsNot', $data);
8585
}
8686

87-
/**
88-
* @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
89-
*/
9087
public function testReadFailsIfNonExistingLocale()
9188
{
89+
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
9290
$this->reader->read(__DIR__.'/Fixtures/res', 'foo');
9391
}
9492

95-
/**
96-
* @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException
97-
*/
9893
public function testReadFailsIfNonExistingFallbackLocale()
9994
{
95+
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
10096
$this->reader->read(__DIR__.'/Fixtures/res', 'ro_AT');
10197
}
10298

103-
/**
104-
* @expectedException \Symfony\Component\Intl\Exception\RuntimeException
105-
*/
10699
public function testReadFailsIfNonExistingDirectory()
107100
{
101+
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
108102
$this->reader->read(__DIR__.'/foo', 'ro');
109103
}
110104
}

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
@@ -746,10 +746,10 @@ function ($value) { return [$value]; },
746746

747747
/**
748748
* @dataProvider provideCurrenciesWithoutNumericEquivalent
749-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
750749
*/
751750
public function testGetNumericCodeFailsIfNoNumericEquivalent($currency)
752751
{
752+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
753753
$this->dataProvider->getNumericCode($currency);
754754
}
755755

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

792792
/**
793793
* @dataProvider provideInvalidNumericCodes
794-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
795794
*/
796795
public function testForNumericCodeFailsIfInvalidNumericCode($currency)
797796
{
797+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
798798
$this->dataProvider->forNumericCode($currency);
799799
}
800800

Tests/Data/Provider/AbstractLanguageDataProviderTest.php

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

939939
/**
940940
* @dataProvider provideLanguagesWithoutAlpha3Equivalent
941-
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
942941
*/
943942
public function testGetAlpha3CodeFailsIfNoAlpha3Equivalent($currency)
944943
{
944+
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
945945
$this->dataProvider->getAlpha3Code($currency);
946946
}
947947
}

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)