Révision 503b3f7b
Ajouté par Assos Assos il y a environ 10 ans
drupal7/sites/all/modules/entity/entity.test | ||
---|---|---|
1443 | 1443 |
$this->assertTrue($wrapper->$name->value() === NULL, 'Property ' . check_plain($name) . ' is empty.'); |
1444 | 1444 |
} |
1445 | 1445 |
|
1446 |
protected function assertEmptyArray($wrapper, $name) { |
|
1447 |
$this->assertTrue(isset($wrapper->$name), 'Property ' . check_plain($name) . ' exists.'); |
|
1448 |
$this->assertTrue($wrapper->$name->value() === array(), 'Property ' . check_plain($name) . ' is an empty array.'); |
|
1449 |
} |
|
1450 |
|
|
1446 | 1451 |
protected function assertValue($wrapper, $key) { |
1447 | 1452 |
$this->assertTrue($wrapper->$key->value() !== NULL, check_plain($key) . ' property returned.'); |
1448 | 1453 |
$info = $wrapper->$key->info(); |
... | ... | |
1470 | 1475 |
|
1471 | 1476 |
// Try using book properties for no book nodes. |
1472 | 1477 |
$wrapper = entity_metadata_wrapper('node', $node3); |
1473 |
$this->assertException($wrapper, 'book');
|
|
1474 |
$this->assertException($wrapper, 'book_ancestors');
|
|
1478 |
$this->assertEmpty($wrapper, 'book');
|
|
1479 |
$this->assertEmptyArray($wrapper, 'book_ancestors');
|
|
1475 | 1480 |
} |
1476 | 1481 |
|
1477 | 1482 |
/** |
... | ... | |
1579 | 1584 |
$this->assertValue($wrapper, $key); |
1580 | 1585 |
} |
1581 | 1586 |
} |
1582 |
$this->assertException($wrapper, 'book');
|
|
1583 |
$this->assertException($wrapper, 'book_ancestors');
|
|
1587 |
$this->assertEmpty($wrapper, 'book');
|
|
1588 |
$this->assertEmptyArray($wrapper, 'book_ancestors');
|
|
1584 | 1589 |
$this->assertEmpty($wrapper, 'source'); |
1585 | 1590 |
$this->assertException($wrapper->source, 'title'); |
1586 | 1591 |
$this->assertEmpty($wrapper, 'last_view'); |
Formats disponibles : Unified diff
Weekly update of contrib modules