1212namespace Symfony \Component \Intl \Tests \DateFormatter ;
1313
1414use Symfony \Component \Intl \DateFormatter \IntlDateFormatter ;
15+ use Symfony \Component \Intl \Exception \MethodArgumentNotImplementedException ;
16+ use Symfony \Component \Intl \Exception \MethodArgumentValueNotImplementedException ;
17+ use Symfony \Component \Intl \Exception \MethodNotImplementedException ;
18+ use Symfony \Component \Intl \Exception \NotImplementedException ;
1519use Symfony \Component \Intl \Globals \IntlGlobals ;
1620
1721class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
@@ -36,7 +40,7 @@ public function testConstructorWithoutCalendar()
3640
3741 public function testConstructorWithUnsupportedLocale ()
3842 {
39- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ MethodArgumentValueNotImplementedException::class);
43+ $ this ->expectException (MethodArgumentValueNotImplementedException::class);
4044 $ this ->getDateFormatter ('pt_BR ' , IntlDateFormatter::MEDIUM , IntlDateFormatter::SHORT );
4145 }
4246
@@ -66,23 +70,23 @@ public function testFormatWithUnsupportedTimestampArgument()
6670 try {
6771 $ formatter ->format ($ localtime );
6872 } catch (\Exception $ e ) {
69- $ this ->assertInstanceOf (\ Symfony \ Component \ Intl \ Exception \ MethodArgumentValueNotImplementedException::class, $ e );
73+ $ this ->assertInstanceOf (MethodArgumentValueNotImplementedException::class, $ e );
7074
7175 $ this ->assertStringEndsWith ('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities. ' , $ e ->getMessage ());
7276 }
7377 }
7478
7579 public function testFormatWithUnimplementedChars ()
7680 {
77- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ NotImplementedException::class);
81+ $ this ->expectException (NotImplementedException::class);
7882 $ pattern = 'Y ' ;
7983 $ formatter = $ this ->getDateFormatter ('en ' , IntlDateFormatter::MEDIUM , IntlDateFormatter::SHORT , 'UTC ' , IntlDateFormatter::GREGORIAN , $ pattern );
8084 $ formatter ->format (0 );
8185 }
8286
8387 public function testFormatWithNonIntegerTimestamp ()
8488 {
85- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ NotImplementedException::class);
89+ $ this ->expectException (NotImplementedException::class);
8690 $ formatter = $ this ->getDefaultDateFormatter ();
8791 $ formatter ->format ([]);
8892 }
@@ -107,42 +111,42 @@ public function testIsLenient()
107111
108112 public function testLocaltime ()
109113 {
110- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ MethodNotImplementedException::class);
114+ $ this ->expectException (MethodNotImplementedException::class);
111115 $ formatter = $ this ->getDefaultDateFormatter ();
112116 $ formatter ->localtime ('Wednesday, December 31, 1969 4:00:00 PM PT ' );
113117 }
114118
115119 public function testParseWithNotNullPositionValue ()
116120 {
117- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ MethodArgumentNotImplementedException::class);
121+ $ this ->expectException (MethodArgumentNotImplementedException::class);
118122 $ position = 0 ;
119123 $ formatter = $ this ->getDefaultDateFormatter ('y ' );
120124 $ this ->assertSame (0 , $ formatter ->parse ('1970 ' , $ position ));
121125 }
122126
123127 public function testSetCalendar ()
124128 {
125- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ MethodNotImplementedException::class);
129+ $ this ->expectException (MethodNotImplementedException::class);
126130 $ formatter = $ this ->getDefaultDateFormatter ();
127131 $ formatter ->setCalendar (IntlDateFormatter::GREGORIAN );
128132 }
129133
130134 public function testSetLenient ()
131135 {
132- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ MethodArgumentValueNotImplementedException::class);
136+ $ this ->expectException (MethodArgumentValueNotImplementedException::class);
133137 $ formatter = $ this ->getDefaultDateFormatter ();
134138 $ formatter ->setLenient (true );
135139 }
136140
137141 public function testFormatWithGmtTimeZoneAndMinutesOffset ()
138142 {
139- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ NotImplementedException::class);
143+ $ this ->expectException (NotImplementedException::class);
140144 parent ::testFormatWithGmtTimeZoneAndMinutesOffset ();
141145 }
142146
143147 public function testFormatWithNonStandardTimezone ()
144148 {
145- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ NotImplementedException::class);
149+ $ this ->expectException (NotImplementedException::class);
146150 parent ::testFormatWithNonStandardTimezone ();
147151 }
148152
0 commit comments