Created
December 17, 2014 18:02
-
-
Save iCodeForBananas/06530b108b9348532c40 to your computer and use it in GitHub Desktop.
example phpunit test with self signed ssl certificate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Goutte\Client; | |
class CatalogSignupTest extends PHPUnit_Framework_TestCase | |
{ | |
public function test_successful_catalog_purchase_where_shipping_and_billing_are_the_same_in_washington() | |
{ | |
$email = 'rick' . mt_rand() . '@example.com'; | |
$url = 'http://dev.example.org/catalog/create_account.php'; | |
// 1. Register a new user | |
$client = new Client(); | |
$guzzle = $client->getClient(); //You'll want to pull the Guzzle client out of Goutte to inherit its defaults | |
$guzzle->setDefaultOption('verify', false); //Set the certificate at @mtdowling recommends | |
$client->setClient($guzzle); //Tell Goutte to use your modified Guzzle client | |
$crawler = $client->request('GET', $url); | |
$form = $crawler->filter("#catalog-create-account")->form(); | |
$crawler = $client->submit($form, array( | |
'firstname' => "Rick", | |
'lastname' => "James", | |
'email_address' => $email, | |
'state' => '62', | |
'country' => '203', | |
'password' => "testme", | |
'confirmation' => "testme", | |
'action' => 'process' | |
)); | |
$this->assertContains('Your Account Has Been Created!', $crawler->text()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment