Ejemplo n.º 1
0
 /**
  * [addCall 添加IO CLIENT]
  * @param TestClient $client [description]
  */
 public function addCall(TestClient $client)
 {
     /**
      * 判断用户是否设置了key,如果没有,代为设置,按照添加顺序来设置KEY
      */
     if (empty($client->getKey())) {
         $client->setKey($this->client_key);
         $this->client_key++;
     }
     $this->callList[] = $client;
 }
 /**
  * @Test
  */
 public function testLogoutAction()
 {
     $client = new \TestClient('test', 'test');
     $authClient = $client->auth();
     $link = $authClient->getCrawler()->filter('a[href="/logout"]')->link();
     $authClient->click($link);
     $authClient->followRedirect();
     $authClient->followRedirect();
     // Logout makes 2 redirects
     $crawler = $authClient->getCrawler();
     $this->assertSame('Login Form', trim($crawler->filter('h1')->text()));
     $client->logout();
 }
Ejemplo n.º 3
0
 /**
  * @depends testGetProviderById
  */
 public function testCreateProvider()
 {
     $collection = new Collection();
     $clientId = 'testClientId';
     $clientClassName = TestClient::className();
     $clients = [$clientId => ['class' => $clientClassName]];
     $collection->setClients($clients);
     $provider = $collection->getClient($clientId);
     $this->assertTrue(is_object($provider), 'Unable to create client by config!');
     $this->assertTrue(is_a($provider, $clientClassName), 'Client has wrong class name!');
 }
Ejemplo n.º 4
0
 public function injectModel($data, \TestClient $client)
 {
     \Tracy\Debugger::bardump($data);
     \Tracy\Debugger::bardump($client->doDummy());
 }
Ejemplo n.º 5
0
 public function logout()
 {
     self::$client->request('GET', '/logout');
     self::$client->followRedirect();
     self::$client = null;
 }