File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \UX \LiveComponent \Util ;
13
13
14
+ use Symfony \Component \Routing \Exception \MethodNotAllowedException ;
14
15
use Symfony \Component \Routing \Exception \MissingMandatoryParametersException ;
15
16
use Symfony \Component \Routing \Exception \ResourceNotFoundException ;
16
17
use Symfony \Component \Routing \RouterInterface ;
@@ -43,7 +44,7 @@ public function createFromPreviousAndProps(
43
44
44
45
try {
45
46
$ newUrl = $ this ->createPath ($ previousUrl , $ pathMappedProps );
46
- } catch (ResourceNotFoundException |MissingMandatoryParametersException ) {
47
+ } catch (ResourceNotFoundException |MethodNotAllowedException | MissingMandatoryParametersException ) {
47
48
return null ;
48
49
}
49
50
Original file line number Diff line number Diff line change 12
12
namespace Symfony \UX \LiveComponent \Tests \Unit \Util ;
13
13
14
14
use PHPUnit \Framework \TestCase ;
15
+ use Symfony \Component \Routing \Exception \MethodNotAllowedException ;
15
16
use Symfony \Component \Routing \Exception \MissingMandatoryParametersException ;
16
17
use Symfony \Component \Routing \Exception \ResourceNotFoundException ;
17
18
use Symfony \Component \Routing \RouterInterface ;
@@ -140,6 +141,19 @@ public function testResourceNotFoundException()
140
141
$ this ->assertNull ($ factory ->createFromPreviousAndProps ($ previousUrl , [], []));
141
142
}
142
143
144
+ public function testMethodNotAllowedException ()
145
+ {
146
+ $ previousUrl = '/foo/bar ' ;
147
+ $ router = $ this ->createMock (RouterInterface::class);
148
+ $ router ->expects (self ::once ())
149
+ ->method ('match ' )
150
+ ->with ($ previousUrl )
151
+ ->willThrowException (new MethodNotAllowedException (['GET ' ]));
152
+ $ factory = new UrlFactory ($ router );
153
+
154
+ $ this ->assertNull ($ factory ->createFromPreviousAndProps ($ previousUrl , [], []));
155
+ }
156
+
143
157
public function testMissingMandatoryParametersException ()
144
158
{
145
159
$ previousUrl = '/foo/bar ' ;
You can’t perform that action at this time.
0 commit comments