$table = uniqid('tx_coretest_table');
$GLOBALS['TCA'] = $this->generateTCAForTable($table);
- t3lib_extMgm::addToAllTCAtypes($table, 'newA, newB, fieldA', '', 'before:fieldD');
+ t3lib_extMgm::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'before:fieldD');
// Checking typeA:
$this->assertEquals(
$table = uniqid('tx_coretest_table');
$GLOBALS['TCA'] = $this->generateTCAForTable($table);
- t3lib_extMgm::addToAllTCAtypes($table, 'newA, newB, fieldA', '', 'after:fieldC');
+ t3lib_extMgm::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'after:fieldC');
// Checking typeA:
$this->assertEquals(
$table = uniqid('tx_coretest_table');
$GLOBALS['TCA'] = $this->generateTCAForTable($table);
- t3lib_extMgm::addToAllTCAtypes($table, 'newA, newB, fieldA', 'typeA', 'before:fieldD');
+ t3lib_extMgm::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', 'typeA', 'before:fieldD');
// Checking typeA:
$this->assertEquals(
$table = uniqid('tx_coretest_table');
$GLOBALS['TCA'] = $this->generateTCAForTable($table);
- t3lib_extMgm::addToAllTCAtypes($table, 'newA, newB, fieldA', 'typeA', 'after:fieldC');
+ t3lib_extMgm::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', 'typeA', 'after:fieldC');
// Checking typeA:
$this->assertEquals(
$table = uniqid('tx_coretest_table');
$GLOBALS['TCA'] = $this->generateTCAForTable($table);
- t3lib_extMgm::addFieldsToPalette($table, 'paletteA', 'newA, newB, fieldX', 'before:fieldY');
+ t3lib_extMgm::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'before:fieldY');
$this->assertEquals(
'fieldX, newA, newB, fieldY',
$table = uniqid('tx_coretest_table');
$GLOBALS['TCA'] = $this->generateTCAForTable($table);
- t3lib_extMgm::addFieldsToPalette($table, 'paletteA', 'newA, newB, fieldX', 'after:fieldX');
+ t3lib_extMgm::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'after:fieldX');
$this->assertEquals(
'fieldX, newA, newB, fieldY',
);
}
+ /**
+ * Tests whether fields can be added to all palettes of a regular field before existing ones.
+ * @test
+ * @see t3lib_extMgm::addFieldsToAllPalettesOfField()
+ */
+ public function canAddFieldsToAllPalettesOfFieldBeforeExistingOnes() {
+ $table = uniqid('tx_coretest_table');
+ $GLOBALS['TCA'] = $this->generateTCAForTable($table);
+
+ t3lib_extMgm::addFieldsToAllPalettesOfField($table, 'fieldC', 'newA, newA, newB, fieldX', 'before:fieldY');
+
+ $this->assertEquals(
+ 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']
+ );
+ $this->assertEquals(
+ 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteB']['showitem']
+ );
+ $this->assertEquals(
+ 'fieldX, newA, newB, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteC']['showitem']
+ );
+ $this->assertEquals(
+ 'fieldX, newA, newB, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteD']['showitem']
+ );
+ }
+
+ /**
+ * Tests whether fields can be added to all palettes of a regular field before existing ones.
+ * @test
+ * @see t3lib_extMgm::addFieldsToAllPalettesOfField()
+ */
+ public function canAddFieldsToAllPalettesOfFieldAfterExistingOnes() {
+ $table = uniqid('tx_coretest_table');
+ $GLOBALS['TCA'] = $this->generateTCAForTable($table);
+
+ t3lib_extMgm::addFieldsToAllPalettesOfField($table, 'fieldC', 'newA, newB, fieldX', 'after:fieldX');
+
+ $this->assertEquals(
+ 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']
+ );
+ $this->assertEquals(
+ 'fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteB']['showitem']
+ );
+ $this->assertEquals(
+ 'fieldX, newA, newB, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteC']['showitem']
+ );
+ $this->assertEquals(
+ 'fieldX, newA, newB, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteD']['showitem']
+ );
+ }
+
public function tearDown() {
foreach ($this->globals as $key => $value) {
$GLOBALS[$key] = unserialize($value);
private function generateTCAForTable($table) {
$tca = array();
$tca[$table] = array();
+ $tca[$table]['columns']['fieldC'] = array();
$tca[$table]['types'] = array(
'typeA' => array('showitem' => 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, fieldD'),
'typeB' => array('showitem' => 'fieldA, fieldB, fieldC;labelC;paletteC;specialC, fieldD'),
+ 'typeC' => array('showitem' => 'fieldC;;paletteD'),
);
$tca[$table]['palettes'] = array(
'paletteA' => array('showitem' => 'fieldX, fieldY'),
'paletteB' => array('showitem' => 'fieldX, fieldY'),
+ 'paletteC' => array('showitem' => 'fieldX, fieldY'),
+ 'paletteD' => array('showitem' => 'fieldX, fieldY'),
);
return $tca;