Conjunto de cambios dafc8d8 en sipes para modules_contrib/cck/tests/content.crud.test


Ignorar:
Fecha y hora:
26/05/2016 19:20:21 (hace 8 años)
Autor:
José Gregorio Puentes <jpuentes@…>
Branches:
stable, version-3.0
Children:
f3eebcf
Parents:
2efe680
Mensaje:

se actualizo el modulo

Fichero:
1 editado

Leyenda

No modificado
Añadido
Eliminado
  • modules_contrib/cck/tests/content.crud.test

    r177a560 rdafc8d8  
    11<?php
    2 // $Id: content.crud.test,v 1.4.2.16 2008/12/08 12:41:08 yched Exp $
    32
    43// TODO:
     
    2221  function setUp() {
    2322    $args = func_get_args();
    24     $modules = array_merge(array('content', 'schema', 'text'), $args);
     23    $modules = array_merge(array('content_test', 'content', 'schema', 'text'), $args);
    2524    call_user_func_array(array('parent','setUp'), $modules);
    2625    module_load_include('inc', 'content', 'includes/content.crud');
     
    377376
    378377class ContentCrudBasicTest extends ContentCrudTestCase {
    379   function getInfo() {
     378  public static function getInfo() {
    380379    return array(
    381380      'name' => t('CRUD - Basic API tests'),
     
    433432
    434433class ContentCrudSingleToMultipleTest extends ContentCrudTestCase {
    435   function getInfo() {
     434  public static function getInfo() {
    436435    return array(
    437436      'name' => t('CRUD - Single to multiple'),
     
    508507
    509508class ContentCrudMultipleToSingleTest extends ContentCrudTestCase {
    510   function getInfo() {
     509  public static function getInfo() {
    511510    return array(
    512511      'name' => t('CRUD - Multiple to single'),
     
    642641
    643642class ContentUICrud extends ContentCrudTestCase {
    644   function getInfo() {
     643  public static function getInfo() {
    645644    return array(
    646645      'name' => t('Admin UI'),
     
    887886
    888887class ContentOptionWidgetTest extends ContentCrudTestCase {
    889   function getInfo() {
     888  public static function getInfo() {
    890889    return array(
    891890      'name' => t('Option widgets'),
     
    12351234}
    12361235
     1236class ContentEmptyDeltaTest extends ContentCrudTestCase {
     1237  public static function getInfo() {
     1238    return array(
     1239      'name' => t('Empty deltas'),
     1240      'description' => t('Test leaving empty values on a multivalue field and then removing them.'),
     1241      'group' => t('CCK'),
     1242    );
     1243  }
     1244
     1245  function setUp() {
     1246    parent::setUp();
     1247    $this->loginWithPermissions();
     1248    $this->acquireContentTypes(1);
     1249  }
     1250
     1251  function testEmptyTextField() {
     1252    // Create a content type with a multivalue text field.
     1253    $type = $this->content_types[0];
     1254    $type_url = str_replace('_', '-', $type->type);
     1255    $value1 = $this->randomName(5);
     1256    $value2 = $this->randomName(5);
     1257    $value3 = $this->randomName(5);
     1258    $field = $this->createFieldText(array('text_processing' => 0, 'multiple' => 1));
     1259    $field_name = $field['field_name'];
     1260
     1261    // Create a node with three values set.
     1262    $edit = array(
     1263      'title' => $this->randomName(20),
     1264      'body' => $this->randomName(20),
     1265      'type' => $type->name,
     1266    );
     1267    $edit[$field_name][0]['value'] = $value1;
     1268    $edit[$field_name][1]['value'] = $value2;
     1269    $edit[$field_name][2]['value'] = $value3;
     1270    $node = $this->drupalCreateNode($edit);
     1271    $max_delta = max(array_keys($node->{$field_name}));
     1272    $this->assertEqual($max_delta, 2, 'Three values saved, highest delta is 2');
     1273    $this->drupalGet('node/'. $node->nid);
     1274    $this->assertText($value1, 'First value displayed');
     1275    $this->assertText($value2, 'Second value displayed');
     1276    $this->assertText($value3, 'Third value displayed');
     1277
     1278    // Set second value to an empty string.
     1279    $node->{$field_name}[1]['value'] = '';
     1280    node_save($node);
     1281    $node = node_load($node->nid, NULL, TRUE);
     1282    $this->assertIdentical($node->{$field_name}[1]['value'], NULL, 'Second value is empty');
     1283    $max_delta = max(array_keys($node->{$field_name}));
     1284    $this->assertEqual($max_delta, 2, 'Three values saved, highest delta is 2');
     1285    $this->drupalGet('node/'. $node->nid);
     1286    $this->assertText($value1, 'First value displayed');
     1287    $this->assertNoText($value2, 'Second value not displayed');
     1288    $this->assertText($value3, 'Third value displayed');
     1289
     1290    // Remove the second value.
     1291    $node->{$field_name}[1]['_remove'] = 1;
     1292    node_save($node);
     1293    $node = node_load($node->nid, NULL, TRUE);
     1294    $this->assertEqual($node->{$field_name}[1]['value'], $value3, 'Third value has moved to delta 1');
     1295    $max_delta = max(array_keys($node->{$field_name}));
     1296    $this->assertEqual($max_delta, 1, 'Two values saved, highest delta is 1');
     1297    $this->drupalGet('node/'. $node->nid);
     1298    $this->assertText($value1, 'First value displayed');
     1299    $this->assertNoText($value2, 'Second value not displayed');
     1300    $this->assertText($value3, 'Third value displayed');
     1301  }
     1302}
Nota: Vea TracChangeset para ayuda en el uso del visor de conjuntos de cambios.