Skip to content

Instantly share code, notes, and snippets.

@iCodeForBananas
Created December 17, 2014 18:02
Show Gist options
  • Save iCodeForBananas/06530b108b9348532c40 to your computer and use it in GitHub Desktop.
Save iCodeForBananas/06530b108b9348532c40 to your computer and use it in GitHub Desktop.

Revisions

  1. iCodeForBananas created this gist Dec 17, 2014.
    37 changes: 37 additions & 0 deletions CatalogTeset.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    <?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());
    }

    }