Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
- Repair coding style
- Change travis settings
- Upgrade doctrine require-dev version
- application.scanDirs: false
  • Loading branch information
mstefan21 committed Oct 18, 2018
1 parent f8e1d2e commit db5e868
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ matrix:
- php: hhvm

before_install:
- if [ $TRAVIS_PHP_VERSION = '5.6' ]; then COVERAGE="-c `php -i | grep 'xdebug.ini'` --coverage coverage.xml --coverage-src src/"; else COVERAGE="" && if [ $TRAVIS_PHP_VERSION = '5.6' ]; then phpenv config-rm xdebug.ini; fi; fi
- if [ $TRAVIS_PHP_VERSION = '5.6' ]; then COVERAGE="-c `php -i | grep 'xdebug.ini'` --coverage coverage.xml --coverage-src=src/ "; else COVERAGE="" && if [ $TRAVIS_PHP_VERSION = '5.6' ]; then phpenv config-rm xdebug.ini; fi; fi
- composer global require hirak/prestissimo

install:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"nette/tester": "~1.7.1",
"mockery/mockery": "~0.9.3",
"dibi/dibi": "~3.0.1",
"kdyby/doctrine": "~3.1.2",
"kdyby/doctrine": "~3.3.0",
"squizlabs/php_codesniffer": "~2.5"
}
}
6 changes: 3 additions & 3 deletions src/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ class Grid extends Components\Container
public function __construct()
{
parent::__construct();
list($parent, $name) = func_get_args() + [null, null];
if ($parent !== null) {
list($parent, $name) = func_get_args() + [NULL, NULL];
if ($parent !== NULL) {
$parent->addComponent($this, $name);
} elseif (is_string($name)) {
} elseif (is_string($name)) {
$this->name = $name;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Components/Operation.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class OperationTest extends \Tester\TestCase
$grid->addColumnText('b', 'B');
$grid->setOperation(['edit' => 'Edit', 'del' => 'Del'], function($operation, $id) {
Assert::same('edit', $operation);
Assert::same(['2','4'], $id);
Assert::same(['2', '4'], $id);
});
};
Helper::grid(function(Grid $grid) use ($definition) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Grid/Grid.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class GridTest extends \Tester\TestCase
Assert::type('\Grido\Translations\FileTranslator', $grid->translator);

Assert::exception(function() use ($grid) {
$grid->translator->lang = 'aa';
$grid->translator->setLang('aa');
}, '\Grido\Exception');
}

Expand Down
14 changes: 9 additions & 5 deletions tests/Grid/GridAsSubcomponent.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ class GridInSubcomponentTest extends \Tester\TestCase

$presenter->onStartUp[] = function(TestPresenter $presenter){

$subcomponent1 = new Subcomponent($presenter, 'subcomponent1');
$grid1 = new Grid($subcomponent1, 'grid');
$subcomponent1 = new Subcomponent();
$presenter->addComponent($subcomponent1, 'subcomponent1');
$grid1 = new Grid();
$subcomponent1->addComponent($grid1, 'grid1');
$grid1->setRememberState();
$session1 = $grid1->getRememberSession();
$session1->name = 'a';
Assert::same($session1->name, 'a');

$subcomponent2 = new Subcomponent($presenter, 'subcomponent2');
$grid2 = new Grid($subcomponent2, 'grid');
$subcomponent2 = new Subcomponent();
$presenter->addComponent($subcomponent2, 'subcomponent2');
$grid2 = new Grid();
$subcomponent2->addComponent($grid2, 'grid2');
$grid2->setRememberState();
$session2 = $grid2->getRememberSession();
$session2->name = 'b';
Expand All @@ -48,4 +52,4 @@ class GridInSubcomponentTest extends \Tester\TestCase
}
}

run(__FILE__);
run(__FILE__);
5 changes: 3 additions & 2 deletions tests/Grid/render.multi.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class Multirender extends \Tester\TestCase
$grid->addColumnText('surname', 'Surname');
$grid->addColumnText('gender', 'Gender');
$grid->addColumnText('birthday', 'Birthday');
$grid->templateFile = $grid->customization->templateFiles[$template];
$templateFiles = $grid->customization->getTemplateFiles();
$grid->templateFile = $templateFiles[$template];
};

$addFilters = function($grid) {
Expand Down Expand Up @@ -178,4 +179,4 @@ class Multirender extends \Tester\TestCase
}
}

run(__FILE__);
run(__FILE__);
5 changes: 4 additions & 1 deletion tests/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ doctrine:
extensions:
console: Kdyby\Console\DI\ConsoleExtension

application:
scanDirs: false

di:
accessors: true
accessors: true

0 comments on commit db5e868

Please sign in to comment.