SetupWebTestCase.php (1257B)
1 <?php 2 /** 3 * Created by PhpStorm. 4 * User: felicitus 5 * Date: 10/9/15 6 * Time: 7:43 PM. 7 */ 8 9 namespace PartKeepr\CoreBundle\Tests; 10 11 /** 12 * Special WebTestCase which forces to load the AppKernel. This is because the base getKernelClass() method 13 * does wildcard matching on *Kernel.php within the app/ directory, and on some systems it might happen that 14 * SetupAppKernel gets loaded first, causing unit tests to fail. 15 */ 16 class SetupWebTestCase extends WebTestCase 17 { 18 public function generateAndGetAuthKey() 19 { 20 $client = static::makeClient(); 21 22 $client->request( 23 'POST', 24 '/setup/generateAuthKey' 25 ); 26 27 return $this->getContainer()->get('partkeepr.setup.config_service')->getAuthKey(); 28 } 29 30 public function getConfiguration($authKey) 31 { 32 $client = static::makeClient(); 33 34 $voidConfig = [ 35 'authKey' => $authKey, 36 'values' => [], 37 ]; 38 $client->request( 39 'POST', 40 '/setup/parseExistingConfig', 41 [], 42 [], 43 [], 44 json_encode($voidConfig) 45 ); 46 47 $responseObj = json_decode($client->getResponse()->getContent(), true); 48 49 return $responseObj['config']; 50 } 51 }