本文整理汇总了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();
}
示例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());
}
示例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()));
}
示例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;
}
示例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();
}
}
示例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();
}