Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

Commit

Permalink
Update compatibility with Nette 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelJurasek committed Apr 1, 2019
1 parent 26ba981 commit ccadf38
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 63 deletions.
99 changes: 51 additions & 48 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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" : "[email protected]",
"homepage" : "http://www.ipublikuj.eu/"
},
{
"name": "David Grudl",
"email": "[email protected]"
}
],

"support": {
"email" :"[email protected]",
"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": "[email protected]",
"homepage": "http://www.ipublikuj.eu/"
},
{
"name": "David Grudl",
"email": "[email protected]"
}
],
"support": {
"email": "[email protected]",
"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/"
}
}
}
5 changes: 1 addition & 4 deletions src/IPub/VisualPaginator/Components/Control.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -256,7 +253,7 @@ public function getSteps()
*
* @return void
*/
public function loadState(array $params)
public function loadState(array $params): void
{
parent::loadState($params);

Expand Down
11 changes: 6 additions & 5 deletions src/IPub/VisualPaginator/DI/VisualPaginatorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']]);
Expand Down
2 changes: 1 addition & 1 deletion tests/IPubTests/VisualPaginator/ComponentTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
7 changes: 3 additions & 4 deletions tests/IPubTests/VisualPaginator/files/presenters.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
nette:
application:
mapping:
*: IPubTests\VisualPaginator\*Presenter
application:
mapping:
*: IPubTests\VisualPaginator\*Presenter

services:
# Test presenter
Expand Down
6 changes: 5 additions & 1 deletion tests/IPubTests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit ccadf38

Please sign in to comment.