public function UbercartFileTestCase::testFilePurchaseCheckout in Ubercart 7.3
File
- uc_file/tests/uc_file.test, line 36
- File download product feature tests.
Class
- UbercartFileTestCase
- Tests the file download purchase functionality.
Code
public function testFilePurchaseCheckout() {
$filename = $this
->uploadTestFile();
$this
->drupalLogin($this->adminUser);
$this
->drupalPost('node/' . $this->product->nid . '/edit/features', array(
'feature' => 'file',
), t('Add'));
$edit = array(
'uc_file_model' => '',
'uc_file_filename' => $filename,
);
$this
->drupalPost(NULL, $edit, t('Save feature'));
$this
->drupalPost('node/' . $this->product->nid, array(), t('Add to cart'));
$order = $this
->checkout();
uc_payment_enter($order->order_id, 'other', $order->order_total);
$this
->drupalGet('user/' . $order->uid . '/purchased-files');
$this
->assertText($filename, 'File found in list of purchased files.');
$mail = $this
->findMail('/File Downloads for Order# ' . preg_quote($order->order_id) . '/');
user_delete($order->uid);
$this
->drupalLogout();
$this
->cronRun();
}