PHPUnit_TestCase($name); } function setUp() { require dirname(__FILE__) . '/_config.inc.php'; require_once '../lib/PayPal.inc.php'; $this->PayPal =& new PayPal(); // Defaults for purchasing classified postings. $this->PayPal->setButtonDefaults('web_accept', array( 'business' => 'paypal@example.com', 'item_name' => 'Test Button', 'no_shipping' => '1', 'no_note' => '1', 'currency_code' => 'USD', )); } function tearDown() { unset($this->PayPal); } function test_setbuttondefaults() { $result = $this->PayPal->setButtonDefaults('web_accept', array( 'item_name' => 'Test Button', 'no_shipping' => '1', 'no_note' => '1', 'currency_code' => 'USD', )); $this->assertTrue($result); } function test_newbutton() { $result = $this->PayPal->newButton('web_accept', 'testitem', array( 'item_name' => 'Test Item', 'amount' => 1.23, 'custom' => 'customdata' )); $this->assertTrue($result); } function test_getlink() { $this->PayPal->newButton('web_accept', 'testitem', array( 'item_name' => 'Test Item', 'amount' => 1.23, 'custom' => 'customdata' )); $result = $this->PayPal->getlink('testitem'); $this->assertTrue(preg_match('/customdata/', $result)); } function test_printbutton() { $this->PayPal->newButton('web_accept', 'testitem', array( 'item_name' => 'Test Item', 'amount' => 1.23, 'custom' => 'customdata' )); ob_start(); $this->PayPal->printbutton('testitem'); $result = ob_get_clean(); $this->assertTrue(preg_match('/customdata/', $result)); } function test_setparam() { $this->PayPal->setparam(array('business' => 'business@example.com')); } function test_getparam() { $this->PayPal->setparam(array('business' => 'business@example.com')); $result = $this->PayPal->getparam('business'); $this->assertEquals('business@example.com', $result); } // function test_incomingipnrequest() // { // $result = $this->PayPal->incomingipnrequest(); // } // // function test_processipn() // { // $result = $this->PayPal->processipn(); // } // // function test_verifiedipn() // { // $result = $this->PayPal->verifiedipn(); // } } // Running the test. $suite = new PHPUnit_TestSuite('PayPalTest'); $result = PHPUnit::run($suite); echo $result->toString(); ?>