Conjunto de cambios dafc8d8 en sipes para modules_contrib/cck/tests/content.crud.test
- Fecha y hora:
- 26/05/2016 19:20:21 (hace 8 años)
- Branches:
- stable, version-3.0
- Children:
- f3eebcf
- Parents:
- 2efe680
- Fichero:
-
- 1 editado
Leyenda
- No modificado
- Añadido
- Eliminado
-
modules_contrib/cck/tests/content.crud.test
r177a560 rdafc8d8 1 1 <?php 2 // $Id: content.crud.test,v 1.4.2.16 2008/12/08 12:41:08 yched Exp $3 2 4 3 // TODO: … … 22 21 function setUp() { 23 22 $args = func_get_args(); 24 $modules = array_merge(array('content ', 'schema', 'text'), $args);23 $modules = array_merge(array('content_test', 'content', 'schema', 'text'), $args); 25 24 call_user_func_array(array('parent','setUp'), $modules); 26 25 module_load_include('inc', 'content', 'includes/content.crud'); … … 377 376 378 377 class ContentCrudBasicTest extends ContentCrudTestCase { 379 function getInfo() {378 public static function getInfo() { 380 379 return array( 381 380 'name' => t('CRUD - Basic API tests'), … … 433 432 434 433 class ContentCrudSingleToMultipleTest extends ContentCrudTestCase { 435 function getInfo() {434 public static function getInfo() { 436 435 return array( 437 436 'name' => t('CRUD - Single to multiple'), … … 508 507 509 508 class ContentCrudMultipleToSingleTest extends ContentCrudTestCase { 510 function getInfo() {509 public static function getInfo() { 511 510 return array( 512 511 'name' => t('CRUD - Multiple to single'), … … 642 641 643 642 class ContentUICrud extends ContentCrudTestCase { 644 function getInfo() {643 public static function getInfo() { 645 644 return array( 646 645 'name' => t('Admin UI'), … … 887 886 888 887 class ContentOptionWidgetTest extends ContentCrudTestCase { 889 function getInfo() {888 public static function getInfo() { 890 889 return array( 891 890 'name' => t('Option widgets'), … … 1235 1234 } 1236 1235 1236 class 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.