for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SilverStripe\Widgets\Tests\WidgetControllerTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\TextField;
use SilverStripe\Widgets\Controllers\WidgetController;
/**
* @package widgets
* @subpackage tests
*/
class TestWidgetController extends WidgetController implements TestOnly
{
private static $allowed_actions = array(
$allowed_actions
This check marks private properties in classes that are never used. Those properties can be removed.
'Form'
);
public function Form()
$widgetform = new Form(
$this,
'Form',
new FieldList(
new TextField('TestValue')
),
new FormAction('doAction')
)
return $widgetform;
}
public function doAction($data, $form)
$form
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
return sprintf(
'TestValue: %s\nWidget ID: %d',
$data['TestValue'],
$this->widget->ID