Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Commit

Permalink
more code
Browse files Browse the repository at this point in the history
  • Loading branch information
bupy7 committed Aug 26, 2016
1 parent d415705 commit b7b89fe
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
12 changes: 8 additions & 4 deletions composer.json
Expand Up @@ -16,12 +16,16 @@
}
],
"require": {
"php": ">=5.6",
"adamwathan/form": "~0.8.9"
"php": "^5.6 || ^7.0",
"adamwathan/form": "~0.8.9",
"zendframework/zend-view": "^2.8",
"zendframework/zend-modulemanager": "^2.7.2",
"zendframework/zend-servicemanager": "^3.1"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "1.0.*"
"phpunit/phpunit": "^5.5",
"satooshi/php-coveralls": "1.0.*",
"zendframework/zend-test": "^3.0.1"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 4 additions & 4 deletions src/FormBuilderFactory.php
Expand Up @@ -4,19 +4,19 @@

use Interop\Container\ContainerInterface;
use AdamWathan\Form\FormBuilder;
use Zend\ServiceManager\Factory\FactoryInterface;

/**
* The factory of `FormBuilder`.
* @author Belosludcev Vasilij <https://github.com/bupy7>
* @since 1.0.0
*/
class FormBuilderFactory
class FormBuilderFactory implements FactoryInterface
{
/**
* @param ContainerInterface $container
* @return FormBuilder
* {@inheritdoc}
*/
public function __invoke(ContainerInterface $container)
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
return new FormBuilder;
}
Expand Down
8 changes: 4 additions & 4 deletions src/View/Helper/FormBuilderHelperFactory.php
Expand Up @@ -3,19 +3,19 @@
namespace Bupy7\Form\View\Helper;

use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;

/**
* The factory of `FormBuilderHelper`.
* @author Belosludcev Vasilij <https://github.com/bupy7>
* @since 1.0.0
*/
class FormBuilderHelperFactory
class FormBuilderHelperFactory implements FactoryInterface
{
/**
* @param ContainerInterface $container
* @return FormBuilderHelper
* {@inheritdoc}
*/
public function __invoke(ContainerInterface $container)
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$formBuilder = $container->get('Bupy7\Form\FormBuilder');
return new FormBuilderHelper($formBuilder);
Expand Down
4 changes: 1 addition & 3 deletions tests/FormBuilderFactoryTest.php
Expand Up @@ -5,7 +5,6 @@
use PHPUnit_Framework_TestCase;
use AdamWathan\Form\FormBuilder;
use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\Config;

/**
* @author Vasilij Belosludcev <https://github.com/bupy7>
Expand All @@ -19,8 +18,7 @@ class FormBuilderFactoryTest extends PHPUnit_Framework_TestCase
public function testInstance()
{
$moduleConfig = require __DIR__ . '/../config/module.config.php';
$config = new Config($moduleConfig['service_manager']);
$serviceManager = new ServiceManager($config);
$serviceManager = new ServiceManager($moduleConfig['service_manager']);

$formBuilder1 = $serviceManager->get('Bupy7\Form\FormBuilder');
$this->assertInstanceOf(FormBuilder::class, $formBuilder1);
Expand Down
1 change: 1 addition & 0 deletions tests/ModuleTestSkip.php → tests/ModuleTest.php
Expand Up @@ -19,6 +19,7 @@ public function testLoader()
{
$moduleLoader = new ModuleLoader([
'modules' => [
'Zend\Router',
'Bupy7\Form',
],
'module_listener_options' => [
Expand Down
7 changes: 2 additions & 5 deletions tests/View/Helper/FormBuilderHelperFactoryTest.php
Expand Up @@ -20,11 +20,8 @@ class FormBuilderHelperFactoryTest extends PHPUnit_Framework_TestCase
public function testInstance()
{
$moduleConfig = require __DIR__ . '/../../../config/module.config.php';
$viewHelpersConfig = new Config($moduleConfig['view_helpers']);
$helperPluginManager = new HelperPluginManager($viewHelpersConfig);
$serviceManagerConfig = new Config($moduleConfig['service_manager']);
$serviceManager = new ServiceManager($serviceManagerConfig);
$helperPluginManager->setServiceLocator($serviceManager);
$serviceManager = new ServiceManager($moduleConfig['service_manager']);
$helperPluginManager = new HelperPluginManager($serviceManager, $moduleConfig['view_helpers']);

$formBuilderHelper1 = $helperPluginManager->get('formBuilder');
$this->assertInstanceOf(FormBuilder::class, $formBuilderHelper1());
Expand Down

0 comments on commit b7b89fe

Please sign in to comment.