12
12
namespace Symfony \Component \ExpressionLanguage \Tests ;
13
13
14
14
use PHPUnit \Framework \TestCase ;
15
+ use Symfony \Bridge \PhpUnit \ForwardCompatTestTrait ;
15
16
use Symfony \Component \ExpressionLanguage \Node \Node ;
16
17
use Symfony \Component \ExpressionLanguage \ParsedExpression ;
17
18
use Symfony \Component \ExpressionLanguage \ParserCache \ParserCacheAdapter ;
21
22
*/
22
23
class ParserCacheAdapterTest extends TestCase
23
24
{
25
+ use ForwardCompatTestTrait;
26
+
24
27
public function testGetItem ()
25
28
{
26
29
$ poolMock = $ this ->getMockBuilder ('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface ' )->getMock ();
@@ -75,7 +78,7 @@ public function testGetItems()
75
78
{
76
79
$ poolMock = $ this ->getMockBuilder ('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface ' )->getMock ();
77
80
$ parserCacheAdapter = new ParserCacheAdapter ($ poolMock );
78
- $ this ->{ method_exists ( $ this , $ _ = ' expectException ' ) ? $ _ : ' setExpectedException ' } (\BadMethodCallException::class);
81
+ $ this ->expectException (\BadMethodCallException::class);
79
82
80
83
$ parserCacheAdapter ->getItems ();
81
84
}
@@ -85,7 +88,7 @@ public function testHasItem()
85
88
$ poolMock = $ this ->getMockBuilder ('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface ' )->getMock ();
86
89
$ key = 'key ' ;
87
90
$ parserCacheAdapter = new ParserCacheAdapter ($ poolMock );
88
- $ this ->{ method_exists ( $ this , $ _ = ' expectException ' ) ? $ _ : ' setExpectedException ' } (\BadMethodCallException::class);
91
+ $ this ->expectException (\BadMethodCallException::class);
89
92
90
93
$ parserCacheAdapter ->hasItem ($ key );
91
94
}
@@ -94,7 +97,7 @@ public function testClear()
94
97
{
95
98
$ poolMock = $ this ->getMockBuilder ('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface ' )->getMock ();
96
99
$ parserCacheAdapter = new ParserCacheAdapter ($ poolMock );
97
- $ this ->{ method_exists ( $ this , $ _ = ' expectException ' ) ? $ _ : ' setExpectedException ' } (\BadMethodCallException::class);
100
+ $ this ->expectException (\BadMethodCallException::class);
98
101
99
102
$ parserCacheAdapter ->clear ();
100
103
}
@@ -104,7 +107,7 @@ public function testDeleteItem()
104
107
$ poolMock = $ this ->getMockBuilder ('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface ' )->getMock ();
105
108
$ key = 'key ' ;
106
109
$ parserCacheAdapter = new ParserCacheAdapter ($ poolMock );
107
- $ this ->{ method_exists ( $ this , $ _ = ' expectException ' ) ? $ _ : ' setExpectedException ' } (\BadMethodCallException::class);
110
+ $ this ->expectException (\BadMethodCallException::class);
108
111
109
112
$ parserCacheAdapter ->deleteItem ($ key );
110
113
}
@@ -114,7 +117,7 @@ public function testDeleteItems()
114
117
$ poolMock = $ this ->getMockBuilder ('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface ' )->getMock ();
115
118
$ keys = ['key ' ];
116
119
$ parserCacheAdapter = new ParserCacheAdapter ($ poolMock );
117
- $ this ->{ method_exists ( $ this , $ _ = ' expectException ' ) ? $ _ : ' setExpectedException ' } (\BadMethodCallException::class);
120
+ $ this ->expectException (\BadMethodCallException::class);
118
121
119
122
$ parserCacheAdapter ->deleteItems ($ keys );
120
123
}
@@ -124,7 +127,7 @@ public function testSaveDeferred()
124
127
$ poolMock = $ this ->getMockBuilder ('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface ' )->getMock ();
125
128
$ parserCacheAdapter = new ParserCacheAdapter ($ poolMock );
126
129
$ cacheItemMock = $ this ->getMockBuilder ('Psr\Cache\CacheItemInterface ' )->getMock ();
127
- $ this ->{ method_exists ( $ this , $ _ = ' expectException ' ) ? $ _ : ' setExpectedException ' } (\BadMethodCallException::class);
130
+ $ this ->expectException (\BadMethodCallException::class);
128
131
129
132
$ parserCacheAdapter ->saveDeferred ($ cacheItemMock );
130
133
}
@@ -133,7 +136,7 @@ public function testCommit()
133
136
{
134
137
$ poolMock = $ this ->getMockBuilder ('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface ' )->getMock ();
135
138
$ parserCacheAdapter = new ParserCacheAdapter ($ poolMock );
136
- $ this ->{ method_exists ( $ this , $ _ = ' expectException ' ) ? $ _ : ' setExpectedException ' } (\BadMethodCallException::class);
139
+ $ this ->expectException (\BadMethodCallException::class);
137
140
138
141
$ parserCacheAdapter ->commit ();
139
142
}
0 commit comments