File tree Expand file tree Collapse file tree
pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -341,4 +341,34 @@ class APIModelsStaticRouteTestCase extends TestCase {
341341 # Delete the gateway used for testing
342342 $ test_gw ->delete (apply: true );
343343 }
344+
345+ /**
346+ * Checks that we can update a newly created static route that has not yet been applied. Regression test for #654.
347+ */
348+ public function test_update_static_route_before_its_applied (): void {
349+ # Create a gateway to use for testing
350+ $ test_gw = new RoutingGateway (
351+ name: 'TESTGW ' ,
352+ interface: 'lan ' ,
353+ ipprotocol: 'inet ' ,
354+ gateway: '192.168.1.10 ' ,
355+ async: false ,
356+ );
357+ $ test_gw ->create ();
358+
359+ # Create a static route using the gateway above, but do not apply it!
360+ $ test_route = new StaticRoute (
361+ gateway: $ test_gw ->name ->value ,
362+ network: '1.2.3.4/32 '
363+ );
364+ $ test_route ->create ();
365+
366+ # Ensure we can update the static route before applying it
367+ $ test_route ->network ->value = '4.3.2.1/32 ' ;
368+ $ test_route ->update ();
369+
370+ # Remove the static route and gateway
371+ $ test_route ->delete ();
372+ $ test_gw ->delete (apply: true );
373+ }
344374}
You can’t perform that action at this time.
0 commit comments