1 | <?php |
||
6 | use SilverStripe\Widgets\Model\Widget; |
||
7 | use SilverStripe\Dev\TestOnly; |
||
8 | use SilverStripe\Forms\TextField; |
||
9 | use SilverStripe\Forms\FieldList; |
||
10 | use SilverStripe\Forms\FormAction; |
||
11 | use SilverStripe\Forms\Form; |
||
12 | use SilverStripe\Widgets\Controllers\WidgetController; |
||
13 | use SilverStripe\Widgets\Tests\WidgetControllerTest\TestPage; |
||
14 | use SilverStripe\Widgets\Tests\WidgetControllerTest\TestWidget; |
||
15 | |||
16 | /** |
||
17 | * @package widgets |
||
18 | * @subpackage tests |
||
19 | */ |
||
20 | class WidgetControllerTest extends FunctionalTest |
||
21 | { |
||
22 | protected static $fixture_file = 'WidgetControllerTest.yml'; |
||
23 | |||
24 | protected $extraDataObjects = array( |
||
25 | TestPage::class, |
||
26 | TestWidget::class, |
||
27 | ); |
||
28 | |||
29 | public function testWidgetFormRendering() |
||
45 | |||
46 | public function testWidgetFormSubmission() |
||
47 | { |
||
48 | $page = $this->objFromFixture(TestPage::class, 'page1'); |
||
49 | $page->copyVersionToStage('Stage', 'Live'); |
||
50 | |||
51 | $widget = $this->objFromFixture(TestWidget::class, 'widget1'); |
||
52 | |||
53 | $response = $this->get($page->URLSegment); |
||
|
|||
54 | $response = $this->submitForm('Form_Form', null, array('TestValue' => 'Updated')); |
||
68 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.