12
12
namespace Symfony \Component \Intl \Tests \DateFormatter ;
13
13
14
14
use 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 ;
15
19
use Symfony \Component \Intl \Globals \IntlGlobals ;
16
20
17
21
class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
@@ -36,7 +40,7 @@ public function testConstructorWithoutCalendar()
36
40
37
41
public function testConstructorWithUnsupportedLocale ()
38
42
{
39
- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ MethodArgumentValueNotImplementedException::class);
43
+ $ this ->expectException (MethodArgumentValueNotImplementedException::class);
40
44
$ this ->getDateFormatter ('pt_BR ' , IntlDateFormatter::MEDIUM , IntlDateFormatter::SHORT );
41
45
}
42
46
@@ -66,23 +70,23 @@ public function testFormatWithUnsupportedTimestampArgument()
66
70
try {
67
71
$ formatter ->format ($ localtime );
68
72
} catch (\Exception $ e ) {
69
- $ this ->assertInstanceOf (\ Symfony \ Component \ Intl \ Exception \ MethodArgumentValueNotImplementedException::class, $ e );
73
+ $ this ->assertInstanceOf (MethodArgumentValueNotImplementedException::class, $ e );
70
74
71
75
$ this ->assertStringEndsWith ('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities. ' , $ e ->getMessage ());
72
76
}
73
77
}
74
78
75
79
public function testFormatWithUnimplementedChars ()
76
80
{
77
- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ NotImplementedException::class);
81
+ $ this ->expectException (NotImplementedException::class);
78
82
$ pattern = 'Y ' ;
79
83
$ formatter = $ this ->getDateFormatter ('en ' , IntlDateFormatter::MEDIUM , IntlDateFormatter::SHORT , 'UTC ' , IntlDateFormatter::GREGORIAN , $ pattern );
80
84
$ formatter ->format (0 );
81
85
}
82
86
83
87
public function testFormatWithNonIntegerTimestamp ()
84
88
{
85
- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ NotImplementedException::class);
89
+ $ this ->expectException (NotImplementedException::class);
86
90
$ formatter = $ this ->getDefaultDateFormatter ();
87
91
$ formatter ->format ([]);
88
92
}
@@ -107,42 +111,42 @@ public function testIsLenient()
107
111
108
112
public function testLocaltime ()
109
113
{
110
- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ MethodNotImplementedException::class);
114
+ $ this ->expectException (MethodNotImplementedException::class);
111
115
$ formatter = $ this ->getDefaultDateFormatter ();
112
116
$ formatter ->localtime ('Wednesday, December 31, 1969 4:00:00 PM PT ' );
113
117
}
114
118
115
119
public function testParseWithNotNullPositionValue ()
116
120
{
117
- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ MethodArgumentNotImplementedException::class);
121
+ $ this ->expectException (MethodArgumentNotImplementedException::class);
118
122
$ position = 0 ;
119
123
$ formatter = $ this ->getDefaultDateFormatter ('y ' );
120
124
$ this ->assertSame (0 , $ formatter ->parse ('1970 ' , $ position ));
121
125
}
122
126
123
127
public function testSetCalendar ()
124
128
{
125
- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ MethodNotImplementedException::class);
129
+ $ this ->expectException (MethodNotImplementedException::class);
126
130
$ formatter = $ this ->getDefaultDateFormatter ();
127
131
$ formatter ->setCalendar (IntlDateFormatter::GREGORIAN );
128
132
}
129
133
130
134
public function testSetLenient ()
131
135
{
132
- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ MethodArgumentValueNotImplementedException::class);
136
+ $ this ->expectException (MethodArgumentValueNotImplementedException::class);
133
137
$ formatter = $ this ->getDefaultDateFormatter ();
134
138
$ formatter ->setLenient (true );
135
139
}
136
140
137
141
public function testFormatWithGmtTimeZoneAndMinutesOffset ()
138
142
{
139
- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ NotImplementedException::class);
143
+ $ this ->expectException (NotImplementedException::class);
140
144
parent ::testFormatWithGmtTimeZoneAndMinutesOffset ();
141
145
}
142
146
143
147
public function testFormatWithNonStandardTimezone ()
144
148
{
145
- $ this ->expectException (\ Symfony \ Component \ Intl \ Exception \ NotImplementedException::class);
149
+ $ this ->expectException (NotImplementedException::class);
146
150
parent ::testFormatWithNonStandardTimezone ();
147
151
}
148
152
0 commit comments