當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Client::enableProfiler方法代碼示例

本文整理匯總了PHP中Symfony\Bundle\FrameworkBundle\Client::enableProfiler方法的典型用法代碼示例。如果您正苦於以下問題:PHP Client::enableProfiler方法的具體用法?PHP Client::enableProfiler怎麽用?PHP Client::enableProfiler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Bundle\FrameworkBundle\Client的用法示例。


在下文中一共展示了Client::enableProfiler方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: enableProfiler

 public function enableProfiler()
 {
     if ($this->getContainer()->has('profiler')) {
         $this->profilerEnabled = true;
     }
     parent::enableProfiler();
 }
開發者ID:facile-it,項目名稱:paraunit-testcase,代碼行數:7,代碼來源:ParaunitTestClient.php

示例2: testSubmit

 public function testSubmit()
 {
     $user = $this->testUtils->createUser()->getUser();
     /** @var EntityManager $entityManager */
     $entityManager = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
     $contactRepository = $entityManager->getRepository('AppBundle:Contact');
     $this->assertEmpty($contactRepository->findBy(['email' => $user->getEmail()]));
     $crawler = $this->client->request('GET', '/contact');
     $form = $crawler->filter('form')->form();
     $message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec at ornare lacus. ' . 'Mauris semper lacus a metus malesuada, at malesuada elit condimentum. ' . 'Proin euismod tellus vitae dolor vestibulum metus.';
     $form['form[message]'] = $message;
     $this->client->enableProfiler();
     // permet de profiler les mails qui vont être envoyés
     $this->client->submit($form);
     $this->assertEquals(Response::HTTP_FOUND, $this->client->getResponse()->getStatusCode());
     $this->testUtils->clearEntities();
     // On vérifie que le contact est en bdd
     /** @var Contact[] $contacts */
     $contacts = $contactRepository->findBy(['email' => $user->getEmail()]);
     $this->assertEquals(1, count($contacts));
     $this->assertEquals($message, $contacts[0]->getMessage());
     $this->assertEquals($user->getId(), $contacts[0]->getUser()->getId());
     /** @var MessageDataCollector $mailCollector */
     $mailCollector = $this->client->getProfile()->getCollector('swiftmailer');
     // 2 mails ont du être envoyés
     $this->assertEquals(2, $mailCollector->getMessageCount());
     $collectedMessages = $mailCollector->getMessages();
     // Le 1er est l'accusé réception à l'utilisateur
     /** @var Swift_Message $accuseReception */
     $accuseReception = $collectedMessages[0];
     $this->assertEquals('Formulaire de contact', $accuseReception->getSubject());
     $this->assertEquals('no-reply@zigotoo.com', key($accuseReception->getFrom()));
     $this->assertEquals('Zigotoo', current($accuseReception->getFrom()));
     $this->assertEquals($user->getEmail(), key($accuseReception->getTo()));
     $this->assertContains($message, $accuseReception->getBody(), 'L\'accusé de réception ne contient pas le message');
     // Le 2eme est une notififaction aux admins
     /** @var Swift_Message $mailAdmins */
     $mailAdmins = $collectedMessages[1];
     $this->assertEquals('Reception formulaire de contact', $mailAdmins->getSubject());
     $this->assertEquals('app@zigotoo.com', key($mailAdmins->getFrom()));
     $this->assertEquals(['pflieger.arnaud@gmail.com', 'MehdiBelkacemi@gmail.com'], array_keys($mailAdmins->getTo()));
     $this->assertContains($message, $mailAdmins->getBody());
     $this->assertContains($user->getEmail(), $mailAdmins->getBody());
 }
開發者ID:apflieger,項目名稱:zigotoo,代碼行數:44,代碼來源:ContactControllerTest.php

示例3: testSendAuthLink

 public function testSendAuthLink()
 {
     // Enable the profiler for the next request (it does nothing if the profiler is not available)
     static::$client->enableProfiler();
     static::$client->request('POST', '/ex-google-analytics/send-external-link', [], [], [], json_encode(['url' => 'https://syrup.keboola.com/ex-google-analytics/external-auth?token=123-456789-abcdefgh', 'user' => 'Test', 'email' => 'test@keboola.com', 'message' => 'test message']));
     $response = json_decode(static::$client->getResponse()->getContent(), true);
     $this->assertArrayHasKey('status', $response);
     $this->assertEquals('ok', $response['status']);
     /** @var MessageDataCollector $mailCollector */
     $mailCollector = self::$client->getProfile()->getCollector('swiftmailer');
     // Check that an e-mail was sent
     $this->assertEquals(1, $mailCollector->getMessageCount());
     $collectedMessages = $mailCollector->getMessages();
     $message = $collectedMessages[0];
     // Asserting e-mail data
     $this->assertInstanceOf('Swift_Message', $message);
     $this->assertEquals('Keboola Google Analytics Extractor account authorization', $message->getSubject());
     $this->assertEquals('support@keboola.com', key($message->getFrom()));
     $this->assertEquals('test@keboola.com', key($message->getTo()));
 }
開發者ID:keboola,項目名稱:google-analytics-bundle,代碼行數:20,代碼來源:MailerTest.php

示例4: startRegistration

 private function startRegistration(\Symfony\Bundle\FrameworkBundle\Client $client, array $fields, $reset = true)
 {
     if ($reset) {
         $this->resetDatabase();
     }
     $crawler = $client->request('GET', '/');
     $buttonNode = $crawler->selectButton('Absenden');
     $form = $buttonNode->form();
     $form->disableValidation();
     $client->enableProfiler();
     $crawler = $client->submit($form, $fields);
     return $crawler;
 }
開發者ID:Galeria-Kaufhof,項目名稱:goodbuy-metro,代碼行數:13,代碼來源:RegistrationTest.php

示例5: submitRequest

 /**
  * @When /^I submit a request to "(.*)"$/
  *
  * @param string $request
  */
 public function submitRequest(string $request)
 {
     list($method, $url) = $this->analyzeURLInput($request);
     if ($this->profilerEnabled) {
         $this->client->enableProfiler();
     }
     $this->client->request($method, $url, $this->requestPayload, [], $this->apiKey ? ['HTTP_X-API-KEY' => $this->apiKey] : []);
     $response = $this->client->getResponse();
     $this->response = $this->decode($response->getContent());
     $this->responseCode = $response->getStatusCode();
     if ($this->profilerEnabled) {
         $this->profiler = $this->client->getProfile();
     }
 }
開發者ID:sententiaregum,項目名稱:sententiaregum,代碼行數:19,代碼來源:ApiContext.php

示例6: enableProfiler

 /**
  * Enables the profiler for the very next request.
  *
  * If the profiler is not enabled, the call to this method does nothing.
  */
 public function enableProfiler()
 {
     $this->subject->enableProfiler();
 }
開發者ID:kleijnweb,項目名稱:swagger-bundle,代碼行數:9,代碼來源:ApiTestClient.php


注:本文中的Symfony\Bundle\FrameworkBundle\Client::enableProfiler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。