Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.75 KB | None | 0 0
  1. class LBWebTestCase extends WebTestCase
  2.  {
  3.      const DEFAULT_PASSWORD = 'test';
  4.      const ENVIRONMENT = 'test';
  5.      const DEFAULT_USER = 'test';
  6.      const DEFAULT_PROVIDER = 'application';
  7.      const DEFAULT_ROLE = 'TCA';
  8.  
  9.      /**
  10.       * @var Client
  11.       */
  12.      protected $client = null;
  13.  
  14.      /**
  15.       * @var Container
  16.       */
  17.      protected $container;
  18.  
  19.      /**
  20.       * Setup default configuration. Creates client, sets router, routes and container
  21.       */
  22.      public function setUp()
  23.      {
  24.          $this->createDefaultClient();
  25.          $this->router = $this->client->getContainer()->get('router');
  26.          $this->routes = $this->router->getRouteCollection();
  27.          $this->container = $this->client->getContainer();
  28.      }
  29.  
  30.      /**
  31.       * creates a default application client with a logged in user:
  32.       * ClientParameters: array('environment' => 'test')
  33.       * ServerParameters: array(
  34.       *   'PHP_AUTH_USER' => 'test',
  35.       *   'PHP_AUTH_PW' => self::DEFAULT_PASSWORD,
  36.       *   'PHP_AUTH_ROLE' => 'TCA'
  37.       *   )
  38.       *
  39.       * @param array|null $clientParams
  40.       * @param array|null $serverParams
  41.       */
  42.      protected function createDefaultClient(array $clientParams = null, array $serverParams = null)
  43.      {
  44.          if ($clientParams === null) {
  45.              $clientParams = array('environment' => self::ENVIRONMENT);
  46.          }
  47.          if ($serverParams === null) {
  48.              $serverParams = array(
  49.                  'PHP_AUTH_USER' => self::DEFAULT_USER,
  50.                  'PHP_AUTH_PW' => self::DEFAULT_PASSWORD,
  51.                  'PHP_AUTH_ROLE' => self::DEFAULT_ROLE
  52.              );
  53.          }
  54.          $this->client = static::createClient($clientParams, $serverParams);
  55.    
  56.      }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement