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 @@ -139,4 +139,18 @@ class APIModelsHAProxyBackendTestCase extends TestCase {
139139 $ backend ->delete ();
140140 $ this ->assert_is_false (HAProxyBackend::query (id: $ backend ->id )->exists ());
141141 }
142+
143+ /**
144+ * Ensure that the HAProxyBackend::$advanced_backend property is base64 encoded internally.
145+ */
146+ public function test_advanced_backend_is_base64 (): void {
147+ # Ensure the advanced_backend property is base64 encoded when converted to internal config value
148+ $ backend = new HAProxyBackend (advanced_backend: 'test ' );
149+ $ this ->assert_equals ($ backend ->advanced_backend ->to_internal (), base64_encode ('test ' ));
150+
151+ # Ensure the advanced_backend property is base64 decoded when converted from internal config value
152+ $ backend = new HAProxyBackend ();
153+ $ backend ->advanced_backend ->from_internal (base64_encode ('test ' ));
154+ $ this ->assert_equals ($ backend ->advanced_backend ->value , 'test ' );
155+ }
142156}
You can’t perform that action at this time.
0 commit comments