silverstripe-framework/tests/php/Forms/GridField/GridField_URLHandlerTest.php

42 lines
1.4 KiB
PHP
Raw Normal View History

<?php
2016-10-14 03:30:05 +02:00
namespace SilverStripe\Forms\Tests\GridField;
2016-10-14 03:30:05 +02:00
use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Forms\Tests\GridField\GridField_URLHandlerTest\TestController;
/**
* 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
];
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());
}
}