@@ -101,6 +101,46 @@ public function testProcessedApiShouldHaveCorrectHttpStatus()
101101 $ this ->assertEquals (200 , $ info ['http_code ' ]);
102102 }
103103
104+ public function testApiMissingRequiredParameterShouldReturn400 ()
105+ {
106+ [$ response , $ info ] = $ this ->curl (
107+ Fixture::getRootUrl () . 'tests/PHPUnit/proxy/index.php?module=API&method=SitesManager.getSiteFromId ' ,
108+ ['token_auth ' => Fixture::ADMIN_USER_TOKEN ]
109+ );
110+
111+ $ this ->assertEquals (400 , $ info ['http_code ' ]);
112+ $ this ->assertStringContainsString ('Please specify a value for \'idSite \'' , $ response );
113+ }
114+
115+ public function testValidModuleInvalidActionShouldReturn404 ()
116+ {
117+ [$ response , $ info ] = $ this ->curl (
118+ Fixture::getRootUrl () . 'tests/PHPUnit/proxy/index.php?module=CoreHome&action=doesNotExist '
119+ );
120+
121+ $ this ->assertEquals (404 , $ info ['http_code ' ]);
122+ $ this ->assertStringContainsString ("Action 'doesNotExist' not found in the module 'CoreHome' " , $ response );
123+ }
124+
125+ public function testMissingAssetChunkShouldReturn404 ()
126+ {
127+ [, $ info ] = $ this ->curl (
128+ Fixture::getRootUrl () . 'tests/PHPUnit/proxy/index.php?module=Proxy&action=getPluginUmdJs&plugin=NotAPlugin '
129+ );
130+
131+ $ this ->assertEquals (404 , $ info ['http_code ' ]);
132+ }
133+
134+ public function testMissingPluginShouldReturn404HttpStatus ()
135+ {
136+ [$ response , $ info ] = $ this ->curl (
137+ Fixture::getRootUrl () . 'tests/PHPUnit/proxy/index.php?module=NotAPlugin&action=index '
138+ );
139+
140+ $ this ->assertEquals (404 , $ info ['http_code ' ]);
141+ $ this ->assertStringContainsString ('The plugin NotAPlugin was not found. ' , $ response );
142+ }
143+
104144 private function curl ($ url , $ postParams = [])
105145 {
106146 if (!function_exists ('curl_init ' )) {
0 commit comments