From ccadf38f81e05d450595b674d276f6ec06855281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jura=CC=81sek?= Date: Mon, 1 Apr 2019 17:49:17 +0200 Subject: [PATCH 1/3] Update compatibility with Nette 3.0 --- composer.json | 99 ++++++++++--------- .../VisualPaginator/Components/Control.php | 5 +- .../DI/VisualPaginatorExtension.php | 11 ++- .../VisualPaginator/ComponentTest.phpt | 2 +- .../VisualPaginator/files/presenters.neon | 7 +- tests/IPubTests/bootstrap.php | 6 +- 6 files changed, 67 insertions(+), 63 deletions(-) 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 From 17f5776bf579bfcb228f617fec6e92342bc2f25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jura=CC=81sek?= Date: Sun, 7 Apr 2019 10:02:14 +0200 Subject: [PATCH 2/3] Update to stable release of Nette --- .travis.yml | 5 ++--- composer.json | 4 ++-- src/IPub/VisualPaginator/DI/VisualPaginatorExtension.php | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9192492..9879965 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,8 @@ env: - NETTE=~2.2.0 php: - - 5.4 - - 5.5 - - 5.6 + - 7.2 + - 7.3 - hhvm matrix: diff --git a/composer.json b/composer.json index 2ad955c..4d6686e 100644 --- a/composer.json +++ b/composer.json @@ -33,8 +33,8 @@ }, "require": { "php": "^7.2", - "nette/application": "^3.0-RC2", - "nette/di": "^3.0-RC3", + "nette/application": "^3.0", + "nette/di": "^3.0", "nette/utils": "^3.0", "latte/latte": "^2.5" }, diff --git a/src/IPub/VisualPaginator/DI/VisualPaginatorExtension.php b/src/IPub/VisualPaginator/DI/VisualPaginatorExtension.php index 8274843..b8b6670 100644 --- a/src/IPub/VisualPaginator/DI/VisualPaginatorExtension.php +++ b/src/IPub/VisualPaginator/DI/VisualPaginatorExtension.php @@ -16,7 +16,6 @@ use Nette; use Nette\DI; -use Nette\PhpGenerator as Code; class VisualPaginatorExtension extends DI\CompilerExtension { From a376b017fb8d95f7a68497e4edde48a5406074e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jura=CC=81sek?= Date: Sun, 7 Apr 2019 10:06:14 +0200 Subject: [PATCH 3/3] Remove nette 2.2 from travis --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9879965..239e098 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: php env: - NETTE=default - - NETTE=~2.2.0 php: - 7.2