Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix, rename and move ReorderFormTest
refs #5525
- Loading branch information
Johannes Meyer
committed
Sep 9, 2014
1 parent
7dbc83e
commit 40947ac
Showing
2 changed files
with
61 additions
and
80 deletions.
There are no files selected for viewing
80 changes: 0 additions & 80 deletions
80
test/php/application/forms/Config/Authentication/ReorderFormTest.php
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
test/php/application/forms/Config/AuthenticationBackendReorderFormTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
// {{{ICINGA_LICENSE_HEADER}}} | ||
// {{{ICINGA_LICENSE_HEADER}}} | ||
|
||
namespace Tests\Icinga\Form\Config; | ||
|
||
use Icinga\Test\BaseTestCase; | ||
use Icinga\Application\Config; | ||
use Icinga\Form\Config\AuthenticationBackendConfigForm; | ||
use Icinga\Form\Config\AuthenticationBackendReorderForm; | ||
|
||
class AuthenticationBackendConfigFormWithoutSave extends AuthenticationBackendConfigForm | ||
{ | ||
public static $newConfig; | ||
|
||
public function save() | ||
{ | ||
self::$newConfig = $this->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' | ||
); | ||
} | ||
} |