Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LBWebTestCase extends WebTestCase
- {
- const DEFAULT_PASSWORD = 'test';
- const ENVIRONMENT = 'test';
- const DEFAULT_USER = 'test';
- const DEFAULT_PROVIDER = 'application';
- const DEFAULT_ROLE = 'TCA';
- /**
- * @var Client
- */
- protected $client = null;
- /**
- * @var Container
- */
- protected $container;
- /**
- * Setup default configuration. Creates client, sets router, routes and container
- */
- public function setUp()
- {
- $this->createDefaultClient();
- $this->router = $this->client->getContainer()->get('router');
- $this->routes = $this->router->getRouteCollection();
- $this->container = $this->client->getContainer();
- }
- /**
- * creates a default application client with a logged in user:
- * ClientParameters: array('environment' => 'test')
- * ServerParameters: array(
- * 'PHP_AUTH_USER' => 'test',
- * 'PHP_AUTH_PW' => self::DEFAULT_PASSWORD,
- * 'PHP_AUTH_ROLE' => 'TCA'
- * )
- *
- * @param array|null $clientParams
- * @param array|null $serverParams
- */
- protected function createDefaultClient(array $clientParams = null, array $serverParams = null)
- {
- if ($clientParams === null) {
- $clientParams = array('environment' => self::ENVIRONMENT);
- }
- if ($serverParams === null) {
- $serverParams = array(
- 'PHP_AUTH_USER' => self::DEFAULT_USER,
- 'PHP_AUTH_PW' => self::DEFAULT_PASSWORD,
- 'PHP_AUTH_ROLE' => self::DEFAULT_ROLE
- );
- }
- $this->client = static::createClient($clientParams, $serverParams);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement