/[drupal]/contributions/modules/pbs/pbs.test
ViewVC logotype

Diff of /contributions/modules/pbs/pbs.test

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.10, Tue Sep 8 19:21:42 2009 UTC revision 1.11, Tue Sep 8 21:39:42 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: pbs.test,v 1.9 2009/09/08 17:48:00 bjaspan Exp $  // $Id: pbs.test,v 1.10 2009/09/08 19:21:42 bjaspan Exp $
3    
4  class PbsTestCase extends DrupalWebTestCase {  class PbsTestCase extends DrupalWebTestCase {
5    function getInfo() {    function getInfo() {
# Line 138  class PbsTestCase extends DrupalWebTestC Line 138  class PbsTestCase extends DrupalWebTestC
138      // Verify that skip_fields is maintained      // Verify that skip_fields is maintained
139      $skip = array();      $skip = array();
140      $ent = reset($entities);      $ent = reset($entities);
141      pbs_field_attach_pre_load($this->entity_type, array($ent->ftid => $ent), FIELD_LOAD_CURRENT, $skip);      pbs_field_attach_pre_load($this->entity_type, array($ent->ftid => $ent), FIELD_LOAD_CURRENT, $skip, array());
142      foreach ($this->fields as $field_name => $field) {      foreach ($this->fields as $field_name => $field) {
143        if ($field['cardinality'] != FIELD_CARDINALITY_UNLIMITED) {        if ($field['cardinality'] != FIELD_CARDINALITY_UNLIMITED) {
144          $this->assertTrue(isset($skip[$field['id']]), "Field $field_name gets set in skip_fields");          $this->assertTrue(isset($skip[$field['id']]), "Field $field_name gets set in skip_fields");
# Line 152  class PbsTestCase extends DrupalWebTestC Line 152  class PbsTestCase extends DrupalWebTestC
152      $skip = array($this->fields['card_1']['id'] => 1);      $skip = array($this->fields['card_1']['id'] => 1);
153      $ent = reset($entities);      $ent = reset($entities);
154      $stub = field_test_create_stub_entity($ent->ftid, $ent->ftvid, 'test_bundle');      $stub = field_test_create_stub_entity($ent->ftid, $ent->ftvid, 'test_bundle');
155      pbs_field_attach_pre_load($this->entity_type, array($stub->ftid => $stub), FIELD_LOAD_CURRENT, $skip);      pbs_field_attach_pre_load($this->entity_type, array($stub->ftid => $stub), FIELD_LOAD_CURRENT, $skip, array());
156      $this->assertTrue(!isset($stub->card_1), 'Field in skip_fields is not loaded');      $this->assertTrue(!isset($stub->card_1), 'Field in skip_fields is not loaded');
157      $this->assertTrue(!empty($stub->card_4), 'Field not in skip_fields is loaded');      $this->assertTrue(!empty($stub->card_4), 'Field not in skip_fields is loaded');
158    }    }
# Line 320  class PbsTestCase extends DrupalWebTestC Line 320  class PbsTestCase extends DrupalWebTestC
320    
321      $stub = field_test_create_stub_entity(12, 0, 'test_bundle');      $stub = field_test_create_stub_entity(12, 0, 'test_bundle');
322      $skip = array();      $skip = array();
323      pbs_field_attach_pre_load($this->entity_type, array($stub->ftid => $stub), FIELD_LOAD_CURRENT, $skip);      pbs_field_attach_pre_load($this->entity_type, array($stub->ftid => $stub), FIELD_LOAD_CURRENT, $skip, array());
324      foreach (array('card_1', 'card_4') as $field_name) {      foreach (array('card_1', 'card_4') as $field_name) {
325        $this->assertEqual(count($entity->{$field_name}), count($stub->{$field_name}), "Field $field_name loaded the correct number of languages.");        $this->assertEqual(count($entity->{$field_name}), count($stub->{$field_name}), "Field $field_name loaded the correct number of languages.");
326        foreach ($entity->{$field_name} as $language => $items) {        foreach ($entity->{$field_name} as $language => $items) {

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.2