/**
  * Tests for displayFormAction()
  *
  * @return void
  * @test
  */
 public function testDisplayFormAction()
 {
     $table = $this->getMockBuilder('PMA\\libraries\\Table')->disableOriginalConstructor()->getMock();
     $table->expects($this->any())->method('getStatusInfo')->will($this->returnValue(""));
     $table->expects($this->any())->method('isView')->will($this->returnValue(false));
     $table->expects($this->any())->method('getNameAndTypeOfTheColumns')->will($this->returnValue(array("field_name" => "field_type")));
     $GLOBALS['dbi']->expects($this->any())->method('getTable')->will($this->returnValue($table));
     $container = Container::getDefaultContainer();
     $container->set('db', 'db');
     $container->set('table', 'table');
     $container->set('dbi', $GLOBALS['dbi']);
     $response = new \PMA\Test\Stubs\Response();
     $container->set('PMA\\libraries\\Response', $response);
     $container->alias('response', 'PMA\\libraries\\Response');
     $index = new PMA\libraries\Index();
     $ctrl = new TableIndexesController($index);
     $_REQUEST['create_index'] = true;
     $_REQUEST['added_fields'] = 3;
     $ctrl->displayFormAction();
     $html = $response->getHTMLResult();
     //PMA_URL_getHiddenInputs
     $this->assertContains(PMA_URL_getHiddenInputs(array('db' => 'db', 'table' => 'table', 'create_index' => 1)), $html);
     $doc_html = PMA\libraries\Util::showHint(PMA\libraries\Message::notice(__('"PRIMARY" <b>must</b> be the name of' . ' and <b>only of</b> a primary key!')));
     $this->assertContains($doc_html, $html);
     $this->assertContains(PMA\libraries\Util::showMySQLDocu('ALTER_TABLE'), $html);
     // generateIndexSelector
     $this->assertContains(PMA\libraries\Template::trim($index->generateIndexChoiceSelector(false)), $html);
     $this->assertContains(sprintf(__('Add %s column(s) to index'), 1), $html);
     //$field_name & $field_type
     $this->assertContains("field_name", $html);
     $this->assertContains("field_type", $html);
 }
 /**
  * Test for trim
  *
  * @return void
  */
 public function testTrim()
 {
     $html = file_get_contents(PMA\libraries\Template::BASE_PATH . 'test/trim.phtml');
     $this->assertEquals('outer <element>value</element> value', PMA\libraries\Template::trim($html));
 }