Пример #1
0
 /**
  * Creates a Client.
  *
  * @param array $options An array of options to pass to the createKernel class
  * @param array $server  An array of server parameters
  * @param bool  $force If this option - true, will reset client on each initClient call
  *
  * @return Client A Client instance
  */
 protected function initClient(array $options = [], array $server = [], $force = false)
 {
     if ($force) {
         $this->resetClient();
     }
     if (!self::$clientInstance) {
         // Fix for: The "native_profiler" extension is not enabled in "*.html.twig".
         // If you still getting this exception please run "php app/console cache:clear --env=test --no-debug".
         // The cache will be cleared and warmed up without the twig profiler.
         if (!isset($options['debug'])) {
             $options['debug'] = false;
         }
         /** @var Client $client */
         $client = self::$clientInstance = static::createClient($options, $server);
         if (self::getDbIsolationSetting()) {
             //This is a workaround for MyISAM search tables that are not transactional
             if (self::getDbReindexSetting()) {
                 self::getContainer()->get('oro_search.search.engine')->reindex();
             }
             $client->startTransaction();
         }
     } else {
         self::$clientInstance->setServerParameters($server);
     }
     $this->client = self::$clientInstance;
 }
 /**
  * @param string $method
  * @param string $url
  * @param int    $code
  * @param array  $urlParameters
  * @param array  $requestParameters
  * @param string $assert
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function request($method, $url, $code, $urlParameters = array(), $requestParameters = array(), $assert = 'assertJsonResponseStatusCodeEquals')
 {
     $server = $this->generateWsse();
     $this->client->setServerParameters($server);
     $this->client->insulate();
     $this->client->request($method, $this->getUrl($url, $urlParameters), $requestParameters);
     $result = $this->client->getResponse();
     $this->{$assert}($result, $code);
     return $result;
 }
Пример #3
0
 /**
  * Creates a Client.
  *
  * @param array $options An array of options to pass to the createKernel class
  * @param array $server  An array of server parameters
  * @param bool  $force If this option - true, will reset client on each initClient call
  *
  * @return Client A Client instance
  */
 protected function initClient(array $options = [], array $server = [], $force = false)
 {
     if ($force) {
         $this->resetClient();
     }
     if (!self::$clientInstance) {
         /** @var Client $client */
         $client = self::$clientInstance = static::createClient($options, $server);
         if (self::getDbIsolationSetting()) {
             //This is a workaround for MyISAM search tables that are not transactional
             if (self::getDbReindexSetting()) {
                 self::getContainer()->get('oro_search.search.engine')->reindex();
             }
             $client->startTransaction();
         }
     } else {
         self::$clientInstance->setServerParameters($server);
     }
     $this->client = self::$clientInstance;
 }