diff --git a/composer.json b/composer.json index a3cbc71..2ad955c 100644 --- a/composer.json +++ b/composer.json @@ -1,50 +1,53 @@ { - "name" : "ipub/visual-paginator", - "type" : "library", - "description" : "Visual paginator for Nette Framework", - "keywords" : ["nette", "ipub", "ipublikuj", "tools", "paginator", "paging"], - "homepage" : "https://github.com/iPublikuj/visual-paginator", - "license" : ["BSD-3-Clause", "GPL-2.0", "GPL-3.0"], - - "authors": [ - { - "name" : "iPublikuj:cms", - "email" : "info@ipublikuj.eu", - "homepage" : "http://www.ipublikuj.eu/" - }, - { - "name": "David Grudl", - "email": "david@grudl.com" - } - ], - - "support": { - "email" :"support@ipublikuj.eu", - "issues" :"https://github.com/iPublikuj/visual-paginator/issues" - }, - - "require": { - "php" : ">=5.4.0", - "nette/application" : "~2.2", - "nette/di" : "~2.2", - "nette/utils" : "~2.2", - "latte/latte" : "~2.2" - }, - - "require-dev": { - "nette/bootstrap" : "~2.2", - "nette/forms" : "~2.2", - "nette/mail" : "~2.2", - "nette/robot-loader" : "~2.2", - "nette/safe-stream" : "~2.2", - "nette/tester" : "@dev", - "tracy/tracy" : "@dev", - "janmarek/mockista" : "@dev" - }, - - "autoload": { - "psr-0": { - "IPub\\VisualPaginator\\": "src/" - } - } + "name": "ipub/visual-paginator", + "type": "library", + "description": "Visual paginator for Nette Framework", + "keywords": [ + "nette", + "ipub", + "ipublikuj", + "tools", + "paginator", + "paging" + ], + "homepage": "https://github.com/iPublikuj/visual-paginator", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "iPublikuj:cms", + "email": "info@ipublikuj.eu", + "homepage": "http://www.ipublikuj.eu/" + }, + { + "name": "David Grudl", + "email": "david@grudl.com" + } + ], + "support": { + "email": "support@ipublikuj.eu", + "issues": "https://github.com/iPublikuj/visual-paginator/issues" + }, + "require": { + "php": "^7.2", + "nette/application": "^3.0-RC2", + "nette/di": "^3.0-RC3", + "nette/utils": "^3.0", + "latte/latte": "^2.5" + }, + "require-dev": { + "nette/bootstrap": "^3.0", + "nette/forms": "^3.0", + "nette/tester": "^2.2", + "tracy/tracy": "^2.6", + "janmarek/mockista": "^1.1" + }, + "autoload": { + "psr-0": { + "IPub\\VisualPaginator\\": "src/" + } + } } diff --git a/src/IPub/VisualPaginator/Components/Control.php b/src/IPub/VisualPaginator/Components/Control.php index 690ca7d..857594e 100644 --- a/src/IPub/VisualPaginator/Components/Control.php +++ b/src/IPub/VisualPaginator/Components/Control.php @@ -90,9 +90,6 @@ public function __construct( $displayRelatedPages = NULL, Nette\ComponentModel\IContainer $parent = NULL, $name = NULL ) { - // TODO: remove, only for tests - parent::__construct(NULL, NULL); - if ($templateFile) { $this->setTemplateFile($templateFile); } @@ -256,7 +253,7 @@ public function getSteps() * * @return void */ - public function loadState(array $params) + public function loadState(array $params): void { parent::loadState($params); diff --git a/src/IPub/VisualPaginator/DI/VisualPaginatorExtension.php b/src/IPub/VisualPaginator/DI/VisualPaginatorExtension.php index 87f6937..8274843 100644 --- a/src/IPub/VisualPaginator/DI/VisualPaginatorExtension.php +++ b/src/IPub/VisualPaginator/DI/VisualPaginatorExtension.php @@ -29,16 +29,17 @@ class VisualPaginatorExtension extends DI\CompilerExtension public function loadConfiguration() { - $config = $this->getConfig($this->defaults); + $config = DI\Config\Helpers::merge($this->getConfig(), $this->defaults); $builder = $this->getContainerBuilder(); // Define components - $paginator = $builder->addDefinition($this->prefix('paginator')) - ->setClass('IPub\VisualPaginator\Components\Control') + $paginator = $builder->addFactoryDefinition($this->prefix('paginator')) ->setImplement('IPub\VisualPaginator\Components\IControl') + ->addTag('cms.components') + ->getResultDefinition() + ->setType('IPub\VisualPaginator\Components\Control') ->setArguments([new Nette\PhpGenerator\PhpLiteral('$templateFile')]) - ->setInject(TRUE) - ->addTag('cms.components'); + ->addTag(DI\Extensions\InjectExtension::TAG_INJECT); if ($config['templateFile']) { $paginator->addSetup('$service->setTemplateFile(?)', [$config['templateFile']]); diff --git a/tests/IPubTests/VisualPaginator/ComponentTest.phpt b/tests/IPubTests/VisualPaginator/ComponentTest.phpt index 177227f..5b8d749 100644 --- a/tests/IPubTests/VisualPaginator/ComponentTest.phpt +++ b/tests/IPubTests/VisualPaginator/ComponentTest.phpt @@ -113,7 +113,7 @@ class ComponentTest extends Tester\TestCase VisualPaginator\DI\VisualPaginatorExtension::register($config); - $config->addConfig(__DIR__ . '/files/presenters.neon', $config::NONE); + $config->addConfig(__DIR__ . '/files/presenters.neon'); return $config->createContainer(); } diff --git a/tests/IPubTests/VisualPaginator/files/presenters.neon b/tests/IPubTests/VisualPaginator/files/presenters.neon index 92a9ed6..4fe7cdc 100644 --- a/tests/IPubTests/VisualPaginator/files/presenters.neon +++ b/tests/IPubTests/VisualPaginator/files/presenters.neon @@ -1,7 +1,6 @@ -nette: - application: - mapping: - *: IPubTests\VisualPaginator\*Presenter +application: + mapping: + *: IPubTests\VisualPaginator\*Presenter services: # Test presenter diff --git a/tests/IPubTests/bootstrap.php b/tests/IPubTests/bootstrap.php index fc479ba..4eb6a56 100644 --- a/tests/IPubTests/bootstrap.php +++ b/tests/IPubTests/bootstrap.php @@ -19,5 +19,9 @@ function id($val) { } function run(Tester\TestCase $testCase) { - $testCase->run(isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : NULL); + if (isset($_SERVER['argv'][2])) { + $testCase->runTest($_SERVER['argv'][2]); + } + + $testCase->run(); } \ No newline at end of file