| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: biblio.test,v 1.1.2.1 2009/11/16 02:24:22 rjerome Exp $ |
| 3 |
/* |
/* |
| 4 |
* @file |
* @file |
| 5 |
* Base class for all biblio tests |
* Base class for all biblio tests |
| 37 |
parent::tearDown(); |
parent::tearDown(); |
| 38 |
} |
} |
| 39 |
|
|
| 40 |
function createNode() { |
function createNode($type = 100) { |
| 41 |
|
$schema = drupal_get_schema('biblio'); |
| 42 |
|
foreach($schema['fields'] as $name => $values) { |
| 43 |
|
if ($values['type'] == 'int') continue; |
| 44 |
|
switch ($values['type']) { |
| 45 |
|
case 'varchar': |
| 46 |
|
$length = $values['length']; |
| 47 |
|
break; |
| 48 |
|
case 'text': |
| 49 |
|
$length = 1000; |
| 50 |
|
break; |
| 51 |
|
} |
| 52 |
|
$biblio_fields["$name"] = $name; |
| 53 |
|
} |
| 54 |
$settings = array( |
$settings = array( |
| 55 |
|
'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => 'Biblio Title'))), |
| 56 |
'type' => 'biblio', // This replaces the default type |
'type' => 'biblio', // This replaces the default type |
| 57 |
'biblio_type' => 100, // This appends a new field. |
'biblio_type' => $type, // This appends a new field. |
| 58 |
'biblio_year' => 2009, |
'biblio_year' => 2009, |
|
'biblio_contributors' => array() |
|
| 59 |
); |
); |
| 60 |
$node = $this->drupalCreateNode($settings); |
$settings = array_merge($biblio_fields, $settings); |
| 61 |
|
|
| 62 |
|
$node = $this->drupalCreateNode($settings); |
| 63 |
|
$node->biblio_contributors[1][] = array('name' => 'Ron J. Jeromezzzzzz', 'auth_type' => 1); |
| 64 |
|
$node->biblio_contributors[1][] = array('name' => 'John Smithzzzzzz', 'auth_type' => 1); |
| 65 |
|
$node->biblio_contributors[1][] = array('name' => 'George W. Bushzzzzzz', 'auth_type' => 1); |
| 66 |
|
biblio_insert_contributors($node); |
| 67 |
|
$node = node_load($node->nid, NULL, TRUE); |
| 68 |
|
foreach($node->biblio_contributors[1] as $author) { |
| 69 |
|
$this->cids[] = $author['cid']; |
| 70 |
|
} |
| 71 |
|
|
| 72 |
$this->nids[] = $node->nid; |
$this->nids[] = $node->nid; |
| 73 |
|
|
| 74 |
return $node; |
return $node; |