diff --git a/libraries/joomla/grid/grid.php b/libraries/joomla/grid/grid.php
deleted file mode 100644
index 44030cd3b5415..0000000000000
--- a/libraries/joomla/grid/grid.php
+++ /dev/null
@@ -1,480 +0,0 @@
- array(), 'footer' => array());
-
- /**
- * Associative array of attributes for the table-tag
- * @var array
- * @since 11.3
- */
- protected $options;
-
- /**
- * Constructor for a JGrid object
- *
- * @param array $options Associative array of attributes for the table-tag
- *
- * @since 11.3
- */
- public function __construct($options = array())
- {
- $this->setTableOptions($options, true);
- }
-
- /**
- * Magic function to render this object as a table.
- *
- * @return string
- *
- * @since 11.3
- */
- public function __toString()
- {
- return $this->toString();
- }
-
- /**
- * Method to set the attributes for a table-tag
- *
- * @param array $options Associative array of attributes for the table-tag
- * @param bool $replace Replace possibly existing attributes
- *
- * @return JGrid This object for chaining
- *
- * @since 11.3
- */
- public function setTableOptions($options = array(), $replace = false)
- {
- if ($replace)
- {
- $this->options = $options;
- }
- else
- {
- $this->options = array_merge($this->options, $options);
- }
-
- return $this;
- }
-
- /**
- * Get the Attributes of the current table
- *
- * @return array Associative array of attributes
- *
- * @since 11.3
- */
- public function getTableOptions()
- {
- return $this->options;
- }
-
- /**
- * Add new column name to process
- *
- * @param string $name Internal column name
- *
- * @return JGrid This object for chaining
- *
- * @since 11.3
- */
- public function addColumn($name)
- {
- $this->columns[] = $name;
-
- return $this;
- }
-
- /**
- * Returns the list of internal columns
- *
- * @return array List of internal columns
- *
- * @since 11.3
- */
- public function getColumns()
- {
- return $this->columns;
- }
-
- /**
- * Delete column by name
- *
- * @param string $name Name of the column to be deleted
- *
- * @return JGrid This object for chaining
- *
- * @since 11.3
- */
- public function deleteColumn($name)
- {
- $index = array_search($name, $this->columns);
-
- if ($index !== false)
- {
- unset($this->columns[$index]);
- $this->columns = array_values($this->columns);
- }
-
- return $this;
- }
-
- /**
- * Method to set a whole range of columns at once
- * This can be used to re-order the columns, too
- *
- * @param array $columns List of internal column names
- *
- * @return JGrid This object for chaining
- *
- * @since 11.3
- */
- public function setColumns($columns)
- {
- $this->columns = array_values($columns);
-
- return $this;
- }
-
- /**
- * Adds a row to the table and sets the currently
- * active row to the new row
- *
- * @param array $options Associative array of attributes for the row
- * @param int $special 1 for a new row in the header, 2 for a new row in the footer
- *
- * @return JGrid This object for chaining
- *
- * @since 11.3
- */
- public function addRow($options = array(), $special = false)
- {
- $this->rows[]['_row'] = $options;
- $this->activeRow = count($this->rows) - 1;
-
- if ($special)
- {
- if ($special === 1)
- {
- $this->specialRows['header'][] = $this->activeRow;
- }
- else
- {
- $this->specialRows['footer'][] = $this->activeRow;
- }
- }
-
- return $this;
- }
-
- /**
- * Method to get the attributes of the currently active row
- *
- * @return array Associative array of attributes
- *
- * @since 11.3
- */
- public function getRowOptions()
- {
- return $this->rows[$this->activeRow]['_row'];
- }
-
- /**
- * Method to set the attributes of the currently active row
- *
- * @param array $options Associative array of attributes
- *
- * @return JGrid This object for chaining
- *
- * @since 11.3
- */
- public function setRowOptions($options)
- {
- $this->rows[$this->activeRow]['_row'] = $options;
-
- return $this;
- }
-
- /**
- * Get the currently active row ID
- *
- * @return int ID of the currently active row
- *
- * @since 11.3
- */
- public function getActiveRow()
- {
- return $this->activeRow;
- }
-
- /**
- * Set the currently active row
- *
- * @param int $id ID of the row to be set to current
- *
- * @return JGrid This object for chaining
- *
- * @since 11.3
- */
- public function setActiveRow($id)
- {
- $this->activeRow = (int) $id;
-
- return $this;
- }
-
- /**
- * Set cell content for a specific column for the
- * currently active row
- *
- * @param string $name Name of the column
- * @param string $content Content for the cell
- * @param array $option Associative array of attributes for the td-element
- * @param bool $replace If false, the content is appended to the current content of the cell
- *
- * @return JGrid This object for chaining
- *
- * @since 11.3
- */
- public function setRowCell($name, $content, $option = array(), $replace = true)
- {
- if ($replace || !isset($this->rows[$this->activeRow][$name]))
- {
- $cell = new stdClass;
- $cell->options = $option;
- $cell->content = $content;
- $this->rows[$this->activeRow][$name] = $cell;
- }
- else
- {
- $this->rows[$this->activeRow][$name]->content .= $content;
- $this->rows[$this->activeRow][$name]->options = $option;
- }
-
- return $this;
- }
-
- /**
- * Get all data for a row
- *
- * @param int $id ID of the row to return
- *
- * @return array Array of columns of a table row
- *
- * @since 11.3
- */
- public function getRow($id = false)
- {
- if ($id === false)
- {
- $id = $this->activeRow;
- }
-
- if (isset($this->rows[(int) $id]))
- {
- return $this->rows[(int) $id];
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Get the IDs of all rows in the table
- *
- * @param int $special false for the standard rows, 1 for the header rows, 2 for the footer rows
- *
- * @return array Array of IDs
- *
- * @since 11.3
- */
- public function getRows($special = false)
- {
- if ($special)
- {
- if ($special === 1)
- {
- return $this->specialRows['header'];
- }
- else
- {
- return $this->specialRows['footer'];
- }
- }
-
- return array_diff(array_keys($this->rows), array_merge($this->specialRows['header'], $this->specialRows['footer']));
- }
-
- /**
- * Delete a row from the object
- *
- * @param int $id ID of the row to be deleted
- *
- * @return JGrid This object for chaining
- *
- * @since 11.3
- */
- public function deleteRow($id)
- {
- unset($this->rows[$id]);
-
- if (in_array($id, $this->specialRows['header']))
- {
- unset($this->specialRows['header'][array_search($id, $this->specialRows['header'])]);
- }
-
- if (in_array($id, $this->specialRows['footer']))
- {
- unset($this->specialRows['footer'][array_search($id, $this->specialRows['footer'])]);
- }
-
- if ($this->activeRow == $id)
- {
- end($this->rows);
- $this->activeRow = key($this->rows);
- }
-
- return $this;
- }
-
- /**
- * Render the HTML table
- *
- * @return string The rendered HTML table
- *
- * @since 11.3
- */
- public function toString()
- {
- $output = array();
- $output[] = '
renderAttributes($this->getTableOptions()) . '>';
-
- if (count($this->specialRows['header']))
- {
- $output[] = $this->renderArea($this->specialRows['header'], 'thead', 'th');
- }
-
- if (count($this->specialRows['footer']))
- {
- $output[] = $this->renderArea($this->specialRows['footer'], 'tfoot');
- }
-
- $ids = array_diff(array_keys($this->rows), array_merge($this->specialRows['header'], $this->specialRows['footer']));
-
- if (count($ids))
- {
- $output[] = $this->renderArea($ids);
- }
-
- $output[] = '
';
-
- return implode('', $output);
- }
-
- /**
- * Render an area of the table
- *
- * @param array $ids IDs of the rows to render
- * @param string $area Name of the area to render. Valid: tbody, tfoot, thead
- * @param string $cell Name of the cell to render. Valid: td, th
- *
- * @return string The rendered table area
- *
- * @since 11.3
- */
- protected function renderArea($ids, $area = 'tbody', $cell = 'td')
- {
- $output = array();
- $output[] = '<' . $area . ">\n";
-
- foreach ($ids as $id)
- {
- $output[] = "\trenderAttributes($this->rows[$id]['_row']) . ">\n";
-
- foreach ($this->getColumns() as $name)
- {
- if (isset($this->rows[$id][$name]))
- {
- $column = $this->rows[$id][$name];
- $output[] = "\t\t<" . $cell . $this->renderAttributes($column->options) . '>' . $column->content . '' . $cell . ">\n";
- }
- }
-
- $output[] = "\t
\n";
- }
-
- $output[] = '' . $area . '>';
-
- return implode('', $output);
- }
-
- /**
- * Renders an HTML attribute from an associative array
- *
- * @param array $attributes Associative array of attributes
- *
- * @return string The HTML attribute string
- *
- * @since 11.3
- */
- protected function renderAttributes($attributes)
- {
- if (count((array) $attributes) == 0)
- {
- return '';
- }
-
- $return = array();
-
- foreach ($attributes as $key => $option)
- {
- $return[] = $key . '="' . $option . '"';
- }
-
- return ' ' . implode(' ', $return);
- }
-}
diff --git a/tests/unit/suites/libraries/joomla/grid/JGridTest.php b/tests/unit/suites/libraries/joomla/grid/JGridTest.php
deleted file mode 100644
index b07ebdd4f8bea..0000000000000
--- a/tests/unit/suites/libraries/joomla/grid/JGridTest.php
+++ /dev/null
@@ -1,618 +0,0 @@
-$name;
- }
- else
- {
- trigger_error('Undefined or private property: ' . __CLASS__ . '::' . $name, E_USER_ERROR);
-
- return null;
- }
- }
-
- /**
- * Sets any property from the class.
- *
- * @param string $property The name of the class property.
- * @param string $value The value of the class property.
- *
- * @return void
- */
- public function __set($property, $value)
- {
- $this->$property = $value;
- }
-
- /**
- * Calls any inaccessible method from the class.
- *
- * @param string $name Name of the method to invoke
- * @param array|bool $parameters Parameters to be handed over to the original method
- *
- * @return mixed The return value of the method
- */
- public function __call($name, $parameters = false)
- {
- return call_user_func_array(array($this, $name), $parameters);
- }
-}
-
-/**
- * Test class for JGrid.
- *
- * @package Joomla.UnitTest
- * @subpackage Github
- *
- * @since 11.3
- */
-class JGridTest extends \PHPUnit\Framework\TestCase
-{
- /**
- * Test for JGrid::__construct method.
- *
- * @return void
- */
- public function test__construct()
- {
- $table = new JGrid;
- $this->assertThat(
- ($table instanceof JGrid),
- $this->isTrue()
- );
-
- $options = array('class' => 'center', 'width' => '50%');
- $table = new JGridInspector($options);
- $this->assertThat(
- $table->options,
- $this->equalTo($options)
- );
- }
-
- /**
- * Test for JGrid::__toString method.
- *
- * @return void
- */
- public function test__toString()
- {
- $table = new JGridInspector;
- $table->addColumn('testCol1');
- $table->addRow(array('class' => 'test1'));
- $table->setRowCell('testCol1', 'testcontent1', array('class' => '1'));
-
- $this->assertThat(
- (string) $table,
- $this->equalTo($table->toString())
- );
- }
-
- /**
- * Test for JGrid::setTableOptions method.
- *
- * @return void
- */
- public function testSetTableOptions()
- {
- $options = array('class' => 'center', 'width' => '50%');
- $table = new JGridInspector;
- $table->setTableOptions($options);
- $this->assertThat(
- $table->options,
- $this->equalTo($options)
- );
- }
-
- /**
- * Test for JGrid::getTableOptions method.
- *
- * @return void
- */
- public function testGetTableOptions()
- {
- $options = array('class' => 'center', 'width' => '50%');
- $table = new JGridInspector;
- $table->options = $options;
- $this->assertThat(
- $table->getTableOptions(),
- $this->equalTo($options)
- );
- }
-
- /**
- * Test for JGrid::addColumn method.
- *
- * @return void
- */
- public function testAddColumn()
- {
- $table = new JGridInspector;
- $table->addColumn('test1');
- $this->assertThat(
- $table->columns,
- $this->equalTo(array('test1'))
- );
- }
-
- /**
- * Test for JGrid::getColumns method.
- *
- * @return void
- */
- public function testGetColumns()
- {
- $table = new JGridInspector;
- $table->columns = array('test1');
- $this->assertThat(
- $table->getColumns(),
- $this->equalTo(array('test1'))
- );
- }
-
- /**
- * Test for JGrid::deleteColumn method.
- *
- * @return void
- */
- public function testDeleteColumn()
- {
- $table = new JGridInspector;
- $table->columns = array('test1', 'test2', 'test3');
- $table->deleteColumn('test2');
- $this->assertThat(
- $table->columns,
- $this->equalTo(array('test1', 'test3'))
- );
- }
-
- /**
- * Test for JGrid::setColumns method.
- *
- * @return void
- */
- public function testSetColumns()
- {
- $table = new JGridInspector;
- $table->columns = array('test1', 'test2', 'test3');
- $array = array('test4', 'test5');
- $table->setColumns($array);
- $this->assertThat(
- $table->columns,
- $this->equalTo(array('test4', 'test5'))
- );
- }
-
- /**
- * Test for JGrid::addRow method.
- *
- * @return void
- */
- public function testAddRow()
- {
- $table = new JGridInspector;
- $table->addRow();
- $this->assertThat(
- $table->rows,
- $this->equalTo(array(0 => array('_row' => array())))
- );
- $this->assertThat(
- $table->activeRow,
- $this->equalTo(0)
- );
- $table->addRow();
- $this->assertThat(
- $table->rows,
- $this->equalTo(array(0 => array('_row' => array()), 1 => array('_row' => array())))
- );
- $this->assertThat(
- $table->activeRow,
- $this->equalTo(1)
- );
- $table->addRow(array('class' => 'test'));
- $this->assertThat(
- $table->rows,
- $this->equalTo(array(0 => array('_row' => array()), 1 => array('_row' => array()), 2 => array('_row' => array('class' => 'test'))))
- );
- $this->assertThat(
- $table->activeRow,
- $this->equalTo(2)
- );
- $table->addRow(array(), 1);
- $this->assertThat(
- $table->specialRows,
- $this->equalTo(array('header' => array(3), 'footer' => array()))
- );
- $table->addRow(array(), 2);
- $this->assertThat(
- $table->specialRows,
- $this->equalTo(array('header' => array(3), 'footer' => array(4)))
- );
- }
-
- /**
- * Test for JGrid::getRowOptions method.
- *
- * @return void
- */
- public function testGetRowOptions()
- {
- $table = new JGridInspector;
-
- $table->rows = array(0 => array('_row' => array()));
- $table->activeRow = 0;
-
- $this->assertThat(
- $table->getRowOptions(),
- $this->equalTo(array())
- );
-
- $new = array('test' => 'test1');
-
- $table->rows = array(0 => array('_row' => $new));
-
- $this->assertThat(
- $table->getRowOptions(),
- $this->equalTo($new)
- );
- }
-
- /**
- * Test for JGrid::setRowOptions method.
- *
- * @return void
- */
- public function testSetRowOptions()
- {
- $table = new JGridInspector;
-
- $table->rows = array(0 => array('_row' => array()));
- $table->activeRow = 0;
-
- $new = array('test' => 'test1');
-
- $table->setRowOptions($new);
-
- $this->assertThat(
- $table->rows[0]['_row'],
- $this->equalTo($new)
- );
- }
-
- /**
- * Test for JGrid::setActiveRow method.
- *
- * @return void
- */
- public function testSetActiveRow()
- {
- $table = new JGridInspector;
- $table->rows = array(array('_row' => array('class' => 'test1')),
- array('_row' => array('class' => 'test2')),
- array('_row' => array('class' => 'test3')));
- $table->activeRow = 2;
- $table->setActiveRow(1);
- $this->assertThat(
- $table->activeRow,
- $this->equalTo(1)
- );
- }
-
- /**
- * Test for JGrid::getActiveRow method.
- *
- * @return void
- */
- public function testGetActiveRow()
- {
- $table = new JGridInspector;
- $table->rows = array(array('_row' => array('class' => 'test1')),
- array('_row' => array('class' => 'test2')),
- array('_row' => array('class' => 'test3')));
- $table->activeRow = 2;
- $this->assertThat(
- $table->getActiveRow(),
- $this->equalTo(2)
- );
- $table->activeRow = 1;
- $this->assertThat(
- $table->getActiveRow(),
- $this->equalTo(1)
- );
- }
-
- /**
- * Test for JGrid::addRowCell method.
- *
- * @return void
- */
- public function testSetRowCell()
- {
- $table = new JGridInspector;
- $table->columns = array('testCol1', 'testCol2', 'testCol3');
- $table->rows = array(array('_row' => array('class' => 'test1')),
- array('_row' => array('class' => 'test2')),
- array('_row' => array('class' => 'test3')));
- $assertion = new stdClass;
- $assertion->options = array();
- $assertion->content = 'testcontent3';
-
- $table->activeRow = 0;
- $table->setRowCell('testCol1', 'testcontent1', array('class' => '1'));
- $table->activeRow = 1;
- $table->setRowCell('testCol2', 'testcontent2');
- $table->activeRow = 2;
- $table->setRowCell('testCol3', 'testcontent3');
- $this->assertThat(
- $table->rows[2],
- $this->equalTo(array('_row' => array('class' => 'test3'), 'testCol3' => $assertion))
- );
- $assertion->content = 'testcontent2';
- $this->assertThat(
- $table->rows[1],
- $this->equalTo(array('_row' => array('class' => 'test2'), 'testCol2' => $assertion))
- );
- $assertion->content = 'testcontent1';
- $assertion->options = array('class' => '1');
- $this->assertThat(
- $table->rows[0],
- $this->equalTo(array('_row' => array('class' => 'test1'), 'testCol1' => $assertion))
- );
-
- // Test replacing existing content
- $table->activeRow = 0;
- $table->setRowCell('testCol1', 'testcontent4', array('test' => 'difcontent'));
- $assertion->content = 'testcontent4';
- $assertion->options = array('test' => 'difcontent');
- $this->assertThat(
- $table->rows[0],
- $this->equalTo(array('_row' => array('class' => 'test1'), 'testCol1' => $assertion))
- );
-
- // Test appending content
- $table->setRowCell('testCol1', ' appendedcontent', array('class' => '1'), false);
- $assertion->content = 'testcontent4 appendedcontent';
- $assertion->options = array('class' => '1');
- $this->assertThat(
- $table->rows[0],
- $this->equalTo(array('_row' => array('class' => 'test1'), 'testCol1' => $assertion))
- );
-
- // Test adding another cell
- $table->setRowCell('testCol2', 'Col2content');
- $assertion2 = new stdClass;
- $assertion2->content = 'Col2content';
- $assertion2->options = array();
- $this->assertThat(
- $table->rows[0],
- $this->equalTo(array('_row' => array('class' => 'test1'), 'testCol1' => $assertion, 'testCol2' => $assertion2))
- );
- }
-
- /**
- * Test for JGrid::getRow method.
- *
- * @return void
- */
- public function testGetRow()
- {
- $table = new JGridInspector;
- $table->columns = array('testCol1');
- $table->rows = array(0 => array('_row' => array('ref' => 'idtest')), 1 => array('_row' => array('class' => 'test1')));
- $table->activeRow = 1;
-
- $this->assertThat(
- $table->getRow(),
- $this->equalTo(array('_row' => array('class' => 'test1')))
- );
-
- $this->assertThat(
- $table->getRow(0),
- $this->equalTo(array('_row' => array('ref' => 'idtest')))
- );
- }
-
- /**
- * Test for JGrid::getRows method.
- *
- * @return void
- */
- public function testGetRows()
- {
- $table = new JGridInspector;
- $table->columns = array('testCol1');
- $assertion = new stdClass;
- $assertion->options = array('class' => '1');
- $assertion->content = 'testcontent1';
-
- $table->rows = array(
- 0 => array('_row' => array('class' => 'test1'), 'testCol1' => $assertion),
- 1 => array('_row' => array('class' => 'test2'), 'testCol1' => $assertion),
- 2 => array('_row' => array('class' => 'test3'), 'testCol1' => $assertion)
- );
- $table->specialRows = array('header' => array(1), 'footer' => array(2));
- $this->assertThat(
- $table->getRows(),
- $this->equalTo(array(0))
- );
- $this->assertThat(
- $table->getRows(1),
- $this->equalTo(array(1))
- );
- $this->assertThat(
- $table->getRows(2),
- $this->equalTo(array(2))
- );
- }
-
- /**
- * Test for JGrid::deleteRow method.
- *
- * @return void
- */
- public function testDeleteRow()
- {
- $table = new JGridInspector;
- $table->columns = array('testCol1');
- $assertion = new stdClass;
- $assertion->options = array('class' => '1');
- $assertion->content = 'testcontent1';
-
- $table->rows = array(
- 0 => array('_row' => array('class' => 'test1'), 'testCol1' => $assertion),
- 1 => array('_row' => array('class' => 'test2'), 'testCol1' => $assertion),
- 2 => array('_row' => array('class' => 'test3'), 'testCol1' => $assertion)
- );
- $table->specialRows = array('header' => array(1), 'footer' => array(2));
-
- $table->deleteRow(0);
- $this->assertThat(
- $table->rows,
- $this->equalTo(
- array(
- 1 => array('_row' => array('class' => 'test2'), 'testCol1' => $assertion),
- 2 => array('_row' => array('class' => 'test3'), 'testCol1' => $assertion)
- )
- )
- );
- $this->assertThat(
- $table->getRow(),
- $this->equalTo(array('_row' => array('class' => 'test3'), 'testCol1' => $assertion))
- );
- $this->assertThat(
- $table->specialRows,
- $this->equalTo(array('header' => array(1), 'footer' => array(2)))
- );
- $table->deleteRow(1);
- $this->assertThat(
- $table->rows,
- $this->equalTo(
- array(
- 2 => array('_row' => array('class' => 'test3'), 'testCol1' => $assertion)
- )
- )
- );
- $this->assertThat(
- $table->getRow(),
- $this->equalTo(array('_row' => array('class' => 'test3'), 'testCol1' => $assertion))
- );
- $this->assertThat(
- $table->specialRows,
- $this->equalTo(array('header' => array(), 'footer' => array(2)))
- );
- $table->deleteRow(2);
- $this->assertThat(
- $table->rows,
- $this->equalTo(array())
- );
- $this->assertThat(
- $table->getRow(),
- $this->equalTo(false)
- );
- $this->assertThat(
- $table->specialRows,
- $this->equalTo(array('header' => array(), 'footer' => array()))
- );
- }
-
- /**
- * Test for JGrid::toString method.
- *
- * @return void
- */
- public function testToString()
- {
- $table = new JGridInspector;
- $table->columns = array('testCol1');
- $assertion = new stdClass;
- $assertion->options = array('class' => '1');
- $assertion->content = 'testcontent1';
- $table->rows = array(array('_row' => array('class' => 'test1'), 'testCol1' => $assertion));
-
- // Make sure the body is rendered correctly
- $this->assertThat(
- $table->toString(),
- $this->equalTo("\n\t\n\t\ttestcontent1 | \n\t
\n
")
- );
-
- // Make sure the header is rendered correctly
- $table->specialRows = array('header' => array(0), 'footer' => array());
-
- $this->assertThat(
- $table->toString(),
- $this->equalTo("\n\t\n\t\ttestcontent1 | \n\t
\n
")
- );
-
- // Make sure the footer is rendered correctly
- $table->specialRows = array('header' => array(), 'footer' => array(0));
-
- $this->assertThat(
- $table->toString(),
- $this->equalTo("\n\t\n\t\ttestcontent1 | \n\t
\n
")
- );
- }
-
- /**
- * Test for JGrid::renderArea method.
- *
- * @return void
- */
- public function testRenderArea()
- {
- $table = new JGridInspector;
- $table->columns = array('testCol1');
- $content = new stdClass;
- $content->options = array('class' => 'test1');
- $content->content = 'testcontent';
- $table->rows = array(0 => array('_row' => array(), 'testCol1' => $content));
- $table->specialRows = array('header' => array(0), 'footer' => array());
- $this->assertThat(
- $table->renderArea(array(0), 'thead', 'th'),
- $this->equalTo("\n\t\n\t\ttestcontent | \n\t
\n")
- );
- }
-
- /**
- * Test for JGrid::renderAttributes method.
- *
- * @return void
- */
- public function testRenderAttributes()
- {
- $table = new JGridInspector;
- $this->assertThat(
- $table->renderAttributes(array('class' => 'test1')),
- $this->equalTo(' class="test1"')
- );
-
- $this->assertThat(
- $table->renderAttributes(array('class' => 'test1', 'ref' => 'test5')),
- $this->equalTo(' class="test1" ref="test5"')
- );
- }
-}