You are here

public function PMInvoiceTestCase::testpminvoiceCreate in Drupal PM (Project Management) 7

Test case covering creation of pminvoices.

File

pminvoice/pminvoice.test, line 47
Test definitions for the PM Invoice module.

Class

PMInvoiceTestCase
@file Test definitions for the PM Invoice module.

Code

public function testpminvoiceCreate() {

  // Create and login user
  $user = $this
    ->drupalCreateUser(array(
    'Project Management Organization: add',
    'Project Management Organization: view all',
    'Project Management invoice: add',
    'Project Management invoice: view all',
  ));
  $this
    ->drupalLogin($user);

  // Create organization and invoice
  $org = array(
    'title' => $this
      ->randomName(32),
    'body[und][0][value]' => $this
      ->randomName(64),
  );
  $inv = array(
    'title' => $this
      ->randomName(32),
    'organization_nid' => '1',
    'items_0_description' => $this
      ->randomName(32),
    'items_0_amount' => '.28',
    'items_0_tax1app' => '1',
    'items_0_tax1percent' => '5',
    'items_0_tax2app' => '2',
    'items_0_tax2percent' => '7.5',
  );
  $this
    ->drupalPost('node/add/pmorganization', $org, t('Save'));
  $this
    ->drupalPost('node/add/pminvoice', $inv, t('Save'));
  $this
    ->assertText(t('Invoice @title has been created.', array(
    '@title' => $inv['title'],
  )));
}