diff --git a/test/php/application/forms/Config/Authentication/ReorderFormTest.php b/test/php/application/forms/Config/Authentication/ReorderFormTest.php deleted file mode 100644 index 808806f1a..000000000 --- a/test/php/application/forms/Config/Authentication/ReorderFormTest.php +++ /dev/null @@ -1,80 +0,0 @@ - $this->order); - } -} - -class ReorderFormTest extends BaseTestCase -{ - public function setUp() - { - parent::setUp(); - $this->viewMock = Mockery::mock('\Zend_View'); - $this->viewMock->shouldReceive('icon')->andReturn(''); - } - - public function testMoveBackendUp() - { - $config = new Zend_Config( - array( - 'test1' => '', - 'test2' => '', - 'test3' => '' - ) - ); - $oldOrder = array_keys($config->toArray()); - - $form = new RequestLessReorderForm(); - $form->setCurrentOrder($oldOrder); - $form->setBackendName('test3'); - $form->setView($this->viewMock); - $form->create(); - - $form->order = $form->getSubForm('btn_reorder_up')->getElement('form_backend_order')->getValue(); - $this->assertSame( - $form->getReorderedConfig($config), - array('test1' => '', 'test3' => '', 'test2' => ''), - 'Moving elements up with ReorderForm does not seem to properly work' - ); - } - - public function testMoveBackendDown() - { - $config = new Zend_Config( - array( - 'test1' => '', - 'test2' => '', - 'test3' => '' - ) - ); - $oldOrder = array_keys($config->toArray()); - - $form = new RequestLessReorderForm(); - $form->setCurrentOrder($oldOrder); - $form->setBackendName('test1'); - $form->setView($this->viewMock); - $form->create(); - - $form->order = $form->getSubForm('btn_reorder_down')->getElement('form_backend_order')->getValue(); - $this->assertSame( - $form->getReorderedConfig($config), - array('test2' => '', 'test1' => '', 'test3' => ''), - 'Moving elements down with ReorderForm does not seem to properly work' - ); - } -} diff --git a/test/php/application/forms/Config/AuthenticationBackendReorderFormTest.php b/test/php/application/forms/Config/AuthenticationBackendReorderFormTest.php new file mode 100644 index 000000000..c79b12fd9 --- /dev/null +++ b/test/php/application/forms/Config/AuthenticationBackendReorderFormTest.php @@ -0,0 +1,61 @@ +config; + return false; + } +} + +class AuthenticationBackendReorderFormProvidingConfigFormWithoutSave extends AuthenticationBackendReorderForm +{ + public function getConfigForm() + { + $form = new AuthenticationBackendConfigFormWithoutSave(); + $form->setIniConfig($this->config); + return $form; + } +} + +class AuthenticationBackendReorderFormTest extends BaseTestCase +{ + public function testMoveBackend() + { + $config = new Config( + array( + 'test1' => '', + 'test2' => '', + 'test3' => '' + ) + ); + + $this->getRequestMock()->shouldReceive('getMethod')->andReturn('POST') + ->shouldReceive('isPost')->andReturn(true) + ->shouldReceive('getPost')->andReturn(array('backend_newpos' => 'test3|1')); + + $form = new AuthenticationBackendReorderFormProvidingConfigFormWithoutSave(); + $form->setIniConfig($config); + $form->setTokenDisabled(); + $form->setUidDisabled(); + $form->handleRequest(); + + $this->assertEquals( + array('test1', 'test3', 'test2'), + AuthenticationBackendConfigFormWithoutSave::$newConfig->keys(), + 'Moving elements with AuthenticationBackendReorderForm does not seem to properly work' + ); + } +}