Skip to content

Commit

Permalink
Merge pull request #15 from szymach/new_release
Browse files Browse the repository at this point in the history
Require stable fsi/admin-bundle 3.0 branch
  • Loading branch information
chives authored Jun 28, 2018
2 parents 7f7efba + 7eb2006 commit 73f40d2
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 40 deletions.
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ sudo: false

cache:
directories:
- $HOME/.composer/cache
- bin
- vendor

matrix:
include:
- php: 7.1
env:
- COMPOSER_FLAGS='--prefer-lowest'
- php: 7.1
- php: 7.2

before_script:
- phpenv config-rm xdebug.ini
- travis_wait 40 composer update $COMPOSER_FLAGS
- travis_wait 20 composer update $COMPOSER_FLAGS
- composer validate

script:
- bin/phpspec run -f pretty
- vendor/bin/phpspec run -f pretty
4 changes: 2 additions & 2 deletions CHANGELOG-2.0.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# CHANGELOG for version 2.0

## Symfony3 support
## Extended Symfony support

As of this version, both Symfony 2 and 3 are suported.
As of this version, Symfony in 2, 4 and 4 versions is suported.

## Dropped support for PHP below 7.1

Expand Down
12 changes: 7 additions & 5 deletions Controller/ReorderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public function __construct(RouterInterface $router)
public function moveUpAction(DataIndexerElement $element, $id, Request $request)
{
$this->getRepository($element)->moveUp($this->getEntity($element, $id));

$this->flush($element);

return $this->getRedirectResponse($element, $request);
Expand All @@ -45,7 +44,6 @@ public function moveUpAction(DataIndexerElement $element, $id, Request $request)
public function moveDownAction(DataIndexerElement $element, $id, Request $request)
{
$this->getRepository($element)->moveDown($this->getEntity($element, $id));

$this->flush($element);

return $this->getRedirectResponse($element, $request);
Expand All @@ -61,8 +59,12 @@ private function getEntity(DataIndexerElement $element, $id)
{
$entity = $element->getDataIndexer()->getData($id);

if (!$entity) {
throw new NotFoundHttpException();
if (null === $entity) {
throw new NotFoundHttpException(sprintf(
'Entity for element "%s" with id "%s" was not found!',
$element->getId(),
$id
));
}

return $entity;
Expand All @@ -78,7 +80,7 @@ private function getRepository(Element $element): NestedTreeRepository

private function assertCorrectRepositoryType(EntityRepository $repository): void
{
if (!$repository instanceof NestedTreeRepository) {
if (false === $repository instanceof NestedTreeRepository) {
throw new InvalidArgumentException(
sprintf("Entity must have repository class 'NestedTreeRepository'")
);
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/FSiAdminTreeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace FSi\Bundle\AdminTreeBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

class FSiAdminTreeExtension extends Extension
{
Expand Down
34 changes: 22 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fsi/admin-tree-bundle",
"type": "symfony-bundle",
"description": "Provides integration for fsi/admin bundle with gedmo/doctrine-extensions tree.",
"description": "Provides integration for fsi/admin-bundle with gedmo/doctrine-extensions tree.",
"keywords": ["admin", "symfony", "bundle", "tree", "fsi", "gedmo", "doctrine-extensions"],
"license": "MIT",
"authors": [
Expand All @@ -11,30 +11,40 @@
}
],
"require": {
"doctrine/orm": "^2.5.2",
"fsi/admin-bundle" : "~2.0|~3.0",
"gedmo/doctrine-extensions": "~2.4",
"php": ">=7.1",
"symfony/framework-bundle" : "^2.3|^3.0|^4.0",
"fsi/admin-bundle" : "^2.0|^3.0@dev",
"gedmo/doctrine-extensions": "^2.4"
"symfony/config" : "~2.4|~3.0|~4.0",
"symfony/dependency-injection" : "^2.6.2|~3.0|~4.0",
"symfony/framework-bundle" : "~2.4|~3.0|~4.0",
"symfony/http-foundation" : "~2.4|~3.0|~4.0",
"symfony/http-kernel" : "~2.4|~3.0|~4.0",
"symfony/routing" : "~2.3|~3.0|~4.0"
},
"require-dev": {
"phpspec/phpspec": "^4.0",
"phpspec/prophecy": "^1.7.2",
"fsi/datagrid": "^2.0@dev",
"fsi/datagrid-bundle": "^2.0@dev",
"fsi/datasource": "^2.0@dev",
"fsi/datasource-bundle": "^2.0@dev"
"phpspec/phpspec": "~3.4|~4.3",
"phpspec/prophecy": "^1.7.6",
"sebastian/comparator": "~3.0",
"sebastian/exporter": "~3.0"
},
"config": {
"bin-dir": "bin"
"bin-dir": "vendor/bin"
},
"autoload": {
"psr-4": {
"FSi\\Bundle\\AdminTreeBundle\\": ""
}
},
"autoload-dev": {
"psr-4": {
"spec\\FSi\\Bundle\\AdminTreeBundle\\": ""
}
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "2.0-dev",
"1.0": "1.0-dev"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Router;
use Symfony\Component\Routing\RouterInterface;

class ReorderControllerSpec extends ObjectBehavior
{
function let(
Router $router,
RouterInterface $router,
CRUDElement $element,
DoctrineDataIndexer $indexer,
ObjectManager $om,
Expand Down Expand Up @@ -59,7 +59,7 @@ function it_moves_up_item_when_move_up_action_called(
NestedTreeRepository $repository,
stdClass $category,
ObjectManager $om,
Router $router,
RouterInterface $router,
DoctrineDataIndexer $indexer,
Request $request
) {
Expand All @@ -84,7 +84,7 @@ function it_moves_down_item_when_move_down_action_called(
NestedTreeRepository $repository,
stdClass $category,
ObjectManager $om,
Router $router,
RouterInterface $router,
DoctrineDataIndexer $indexer,
Request $request
) {
Expand All @@ -111,11 +111,8 @@ function it_throws_runtime_exception_when_specified_entity_doesnt_exist(
) {
$indexer->getData(666)->willThrow(RuntimeException::class);

$this->shouldThrow(RuntimeException::class)
->duringMoveUpAction($element, 666, $request);

$this->shouldThrow(RuntimeException::class)
->duringMoveDownAction($element, 666, $request);
$this->shouldThrow(RuntimeException::class)->duringMoveUpAction($element, 666, $request);
$this->shouldThrow(RuntimeException::class)->duringMoveDownAction($element, 666, $request);
}

function it_throws_exception_when_entity_doesnt_have_correct_repository(
Expand All @@ -128,11 +125,8 @@ function it_throws_exception_when_entity_doesnt_have_correct_repository(
$indexer->getData(666)->willReturn($category);
$element->getRepository()->willReturn($repository);

$this->shouldThrow(InvalidArgumentException::class)
->duringMoveUpAction($element, 666, $request);

$this->shouldThrow(InvalidArgumentException::class)
->duringMoveDownAction($element, 666, $request);
$this->shouldThrow(InvalidArgumentException::class)->duringMoveUpAction($element, 666, $request);
$this->shouldThrow(InvalidArgumentException::class)->duringMoveDownAction($element, 666, $request);
}

function it_redirects_to_redirect_uri_parameter_after_operation(
Expand Down

0 comments on commit 73f40d2

Please sign in to comment.