Révision 01dfd3b5
Ajouté par Assos Assos il y a plus de 3 ans
drupal7/modules/simpletest/tests/common.test | ||
---|---|---|
2051 | 2051 |
|
2052 | 2052 |
// The elements should appear in output in the same order as the array. |
2053 | 2053 |
$this->assertTrue(strpos($output, $second) < strpos($output, $first), 'Elements were not sorted.'); |
2054 |
|
|
2055 |
// The order of children with same weight should be preserved. |
|
2056 |
$element_mixed_weight = array( |
|
2057 |
'child5' => array('#weight' => 10), |
|
2058 |
'child3' => array('#weight' => -10), |
|
2059 |
'child1' => array(), |
|
2060 |
'child4' => array('#weight' => 10), |
|
2061 |
'child2' => array(), |
|
2062 |
'child6' => array('#weight' => 10), |
|
2063 |
'child9' => array(), |
|
2064 |
'child8' => array('#weight' => 10), |
|
2065 |
'child7' => array(), |
|
2066 |
); |
|
2067 |
|
|
2068 |
$expected = array( |
|
2069 |
'child3', |
|
2070 |
'child1', |
|
2071 |
'child2', |
|
2072 |
'child9', |
|
2073 |
'child7', |
|
2074 |
'child5', |
|
2075 |
'child4', |
|
2076 |
'child6', |
|
2077 |
'child8', |
|
2078 |
); |
|
2079 |
$this->assertEqual($expected, element_children($element_mixed_weight, TRUE), 'Order of elements with the same weight is preserved.'); |
|
2054 | 2080 |
} |
2055 | 2081 |
|
2056 | 2082 |
/** |
Formats disponibles : Unified diff
Udpate to 7.77