Skip to content

Commit

Permalink
Adds more test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Manderson committed Sep 11, 2014
1 parent 05b8845 commit 40083e2
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/UtilTest/RequestUtilTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php
namespace UtilTest;

use Phruts\Action\AbstractActionForm;
use Phruts\Action\ActionKernel;
use Phruts\Action\ActionMapping;
use Phruts\Config\FormBeanConfig;
use Phruts\Config\ModuleConfig;
use Phruts\Util\RequestUtils;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -66,12 +68,25 @@ public function testCreateActionForm()
$moduleConfig = new ModuleConfig('');
$application = new \Silex\Application();
$actionMapping = new ActionMapping();
$actionMapping->setName('form');
$actionMapping->setModuleConfig($moduleConfig);
$actionMapping->setScope('request');
$actionKernel = new ActionKernel($application);

$this->assertEmpty(RequestUtils::createActionForm($this->request, $actionMapping, $moduleConfig, $actionKernel));
$formBeanConfig = new FormBeanConfig();
$formBeanConfig->setName('form');
$formBeanConfig->setType('\UtilTest\MyActionForm');
$moduleConfig->addFormBeanConfig($formBeanConfig);
$moduleConfig->addActionConfig($actionMapping);

$actionMapping->setAttribute('attribute');
$form = RequestUtils::createActionForm($this->request, $actionMapping, $moduleConfig, $actionKernel);
$this->assertNotEmpty($form);
$this->assertEquals('UtilTest\MyActionForm', get_class($form));
}


}

class MyActionForm extends AbstractActionForm
{}

0 comments on commit 40083e2

Please sign in to comment.