2012-03-06 22:48:09 +01:00
|
|
|
<?php
|
2012-01-09 23:10:03 +01:00
|
|
|
|
2016-10-14 03:30:05 +02:00
|
|
|
namespace SilverStripe\Forms\Tests\GridField;
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2016-10-14 03:30:05 +02:00
|
|
|
use SilverStripe\Dev\FunctionalTest;
|
|
|
|
use SilverStripe\Forms\Tests\GridField\GridField_URLHandlerTest\TestController;
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2012-01-09 23:10:03 +01:00
|
|
|
/**
|
|
|
|
* Test the API for creating GridField_URLHandler compeonnts
|
|
|
|
*/
|
2016-12-16 05:34:21 +01:00
|
|
|
class GridField_URLHandlerTest extends FunctionalTest
|
|
|
|
{
|
|
|
|
|
2017-03-24 12:17:26 +01:00
|
|
|
protected static $extra_controllers = [
|
|
|
|
TestController::class,
|
2016-12-16 05:34:21 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
public function testFormSubmission()
|
|
|
|
{
|
|
|
|
$result = $this->get("GridField_URLHandlerTest_Controller/Form/field/Grid/showform");
|
|
|
|
$formResult = $this->submitForm('Form_Form', 'action_doAction', array('Test' => 'foo bar'));
|
|
|
|
$this->assertEquals("Submitted foo bar to component", $formResult->getBody());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testNestedRequestHandlerFormSubmission()
|
|
|
|
{
|
|
|
|
$result = $this->get("GridField_URLHandlerTest_Controller/Form/field/Grid/item/3/showform");
|
|
|
|
$formResult = $this->submitForm('Form_Form', 'action_doAction', array('Test' => 'foo bar'));
|
|
|
|
$this->assertEquals("Submitted foo bar to item #3", $formResult->getBody());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testURL()
|
|
|
|
{
|
|
|
|
$result = $this->get("GridField_URLHandlerTest_Controller/Form/field/Grid/testpage");
|
|
|
|
$this->assertEquals("Test page for component", $result->getBody());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testNestedRequestHandlerURL()
|
|
|
|
{
|
|
|
|
$result = $this->get("GridField_URLHandlerTest_Controller/Form/field/Grid/item/5/testpage");
|
|
|
|
$this->assertEquals("Test page for item #5", $result->getBody());
|
|
|
|
}
|
2012-01-09 23:10:03 +01:00
|
|
|
}
|