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
|
|
|
|
2016-06-15 06:03:16 +02:00
|
|
|
|
2012-01-09 23:10:03 +01:00
|
|
|
/**
|
|
|
|
* Test the API for creating GridField_URLHandler compeonnts
|
|
|
|
*/
|
|
|
|
class GridField_URLHandlerTest extends FunctionalTest {
|
2016-10-14 03:30:05 +02:00
|
|
|
|
|
|
|
protected $extraControllers = [
|
|
|
|
TestController::class
|
|
|
|
];
|
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testFormSubmission() {
|
2012-01-09 23:10:03 +01:00
|
|
|
$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());
|
|
|
|
}
|
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testNestedRequestHandlerFormSubmission() {
|
2012-01-09 23:10:03 +01:00
|
|
|
$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());
|
|
|
|
}
|
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testURL() {
|
2012-01-09 23:10:03 +01:00
|
|
|
$result = $this->get("GridField_URLHandlerTest_Controller/Form/field/Grid/testpage");
|
|
|
|
$this->assertEquals("Test page for component", $result->getBody());
|
|
|
|
}
|
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testNestedRequestHandlerURL() {
|
2012-01-09 23:10:03 +01:00
|
|
|
$result = $this->get("GridField_URLHandlerTest_Controller/Form/field/Grid/item/5/testpage");
|
|
|
|
$this->assertEquals("Test page for item #5", $result->getBody());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|