forked from braintree/braintree_php_example
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIndexPageTest.php
More file actions
43 lines (35 loc) · 1.25 KB
/
IndexPageTest.php
File metadata and controls
43 lines (35 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
require_once("tests/TestHelper.php");
class IndexPageTest extends PHPUnit_Framework_TestCase
{
function test_returnsHttpSuccess()
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "localhost:3000");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_exec($curl);
$httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
$this->assertEquals($httpStatus, 200);
}
function test_clientTokenOnPage()
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "localhost:3000");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
curl_close($curl);
$this->assertRegExp('/var client_token = ".*";/', $output);
}
function test_checkoutFormOnPage()
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "localhost:3000");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
curl_close($curl);
$this->assertRegExp('/<form method="post" id="payment-form"/', $output);
$this->assertRegExp('/<div id="bt-dropin"/', $output);
$this->assertRegExp('/<input id="amount" name="amount" type="tel"/', $output);
}
}