Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
New testing folder structure for implementing better kernel, firt poi…
Browse files Browse the repository at this point in the history
…nts on way to SF4 compatiblility

* Fix menu elements root (#127)

Improvements to run the tests

use new testing version

remove deprecated method

DevKit updates

DevKit updates

DevKit updates

DevKit updates

DevKit updates

move files to new test app structure

DevKit updates

new test app structure

fixes due to StyleCI

fix phpcr-odm version

make all admin services public

make a block admin public too

add admin bundles to own bundles.php

DevKit updates

DevKit updates

DevKit updates

DevKit updates

DevKit updates

DevKit updates

DevKit updates

DevKit updates

DevKit updates

DevKit updates

DevKit updates

DevKit updates

DevKit updates

do not require non existing bundle set anymore

remove fos jsrouting-bundle decleration

* remove use stmt.

* use newer menu-bundle version

* use a fork for symfony compat of the ckeditor bundle

* fix composer.json

* use own branch

* avoid private service deprecation by using new compile pass in testing component

* fix repository

* use other repository url

* revert ckeditor change

* remove symfony dependency
  • Loading branch information
ElectricMaxxx authored Jan 23, 2018
1 parent 6dc1584 commit 053acda
Show file tree
Hide file tree
Showing 59 changed files with 222 additions and 182 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tests/Resources/app/cache
tests/Resources/app/logs
tests/Fixtures/App/var/cache
tests/Fixtures/App/var/logs
!tests/Fixtures/App/var/.gitempty
composer.lock
vendor
22 changes: 8 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,33 @@ cache:
- $HOME/.composer/cache/files

env:
matrix: SYMFONY_VERSION=3.4
matrix: SYMFONY_VERSION=4.0.*
global:
- SYMFONY_DEPRECATIONS_HELPER=48
- SYMFONY_DEPRECATIONS_HELPER=0
- SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml"
- KERNEL_CLASS=Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Tests\Fixtures\App\Kernel
- SYMFONY_PHPUNIT_VERSION=5.7
- TEST_INSTALLATION=false

matrix:
include:
- php: 7.1
env: SYMFONY_VERSION=3.4.*
env: STABILITY=dev SYMFONY_VERSION=4.0.*
- php: 7.1
env: DEPS=dev SYMFONY_VERSION=3.3.*
- php: 7.0
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=2.8.* SYMFONY_DEPRECATIONS_HELPER=weak
env: STABILITY=dev COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=2.8.* SYMFONY_DEPRECATIONS_HELPER=weak
- php: 7.1
env: SYMFONY_VERSION=3.1.*
env: STABILITY=dev SYMFONY_VERSION=3.3.*
- php: 7.1
env: SYMFONY_VERSION=3.2.*
env: STABILITY=dev SYMFONY_VERSION=3.4.*
- env: TEST_INSTALLATION=true

fast_finish: true
allow_failures:
- php: 7.1
env: SYMFONY_VERSION=3.4.*
- env: TEST_INSTALLATION=true


before_install:
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi
- phpenv config-rm xdebug.ini || true
- composer self-update
- if [ "$DEPS" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; composer config prefer-stable true; fi;
- if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ifdef BRANCH
VERSION=dev-${BRANCH}
endif
PACKAGE=symfony-cmf/sonata-phpcr-admin-integration-bundle

export KERNEL_CLASS=Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Tests\Fixtures\App\Kernel
list:
@echo 'test: will run all tests'
@echo 'unit_tests: will run unit tests only'
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ under the [MIT License](LICENSE).

## Requirements

* PHP 7.0 / 7.1
* Symfony 2.8 / 3.1 / 3.2 / 3.3
* PHP 7.1
* Symfony 2.8 / 3.3 / 3.4 / 4.0
* See also the `require` section of [composer.json](composer.json)

## Documentation
Expand All @@ -41,7 +41,7 @@ For general support and questions, please use [StackOverflow](http://stackoverfl
## Contributing

Pull requests are welcome. Please see our
[CONTRIBUTING](https://github.com/symfony-cmf/symfony-cmf/blob/master/CONTRIBUTING.md)
[CONTRIBUTING](https://github.com/symfony-cmf/blob/master/CONTRIBUTING.md)
guide.

Unit and/or functional tests exist for this package. See the
Expand Down
55 changes: 35 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"name": "symfony-cmf/sonata-phpcr-admin-integration-bundle",
"type": "symfony-bundle",
"description": "Symfony CMF sonata admin implementations",
"keywords": ["Symfony CMF", "Sonata", "Admin"],
"keywords": [
"Symfony CMF",
"Sonata",
"Admin"
],
"homepage": "http://cmf.symfony.com",
"license": "MIT",
"authors": [
Expand All @@ -12,31 +16,32 @@
}
],
"require": {
"php": "^5.6|^7.0",
"symfony/framework-bundle": "^2.8|^3.0",
"sonata-project/doctrine-phpcr-admin-bundle": "^2.0.0-RC4",
"php": "^7.1",
"symfony/framework-bundle": "^2.8 || ^3.3 || ^4.0",
"sonata-project/doctrine-phpcr-admin-bundle": "^2.1",
"sonata-project/admin-bundle": "^3.6.0",
"symfony-cmf/tree-browser-bundle": "^2.0"
},
"require-dev": {
"symfony-cmf/testing": "^2.1@dev",
"symfony-cmf/core-bundle": "^2.0",
"symfony-cmf/routing-bundle": "^2.0",
"symfony-cmf/seo-bundle": "^2.0",
"symfony-cmf/menu-bundle": "^2.0",
"symfony-cmf/block-bundle": "^2.0",
"symfony-cmf/content-bundle": "^2.0",
"symfony-cmf/testing": "^2.1",
"symfony-cmf/core-bundle": "^2.1",
"symfony-cmf/routing-bundle": "^2.1",
"symfony-cmf/seo-bundle": "^2.1",
"symfony-cmf/menu-bundle": "^2.2",
"symfony-cmf/block-bundle": "^2.1",
"symfony-cmf/content-bundle": "^2.1",
"doctrine/orm": "^2.4",
"doctrine/phpcr-odm": "^2.0",
"doctrine/phpcr-odm": "^1.4|^2.0",
"doctrine/doctrine-bundle": "^1.3",
"symfony/phpunit-bridge": "^3.2",
"matthiasnoback/symfony-dependency-injection-test": "~0.6",
"matthiasnoback/symfony-config-test": "^1.3.1",
"symfony/phpunit-bridge": "^3.3 || ^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^1.1",
"matthiasnoback/symfony-config-test": "^2.1",
"burgov/key-value-form-bundle": "^1.0",
"egeloen/ckeditor-bundle": "^4.0"
"egeloen/ckeditor-bundle": "^4.0",
"symfony/asset": "^2.8 || ^3.3 || ^4.0",
"symfony/browser-kit": "^2.8 || ^3.3 || ^4.0",
"symfony/css-selector": "^2.8 || ^3.3 || ^4.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
"suggest": {
"symfony-cmf/routing-bundle": "To make use of the alternate locale provider.",
"doctrine/phpcr-bundle": "To persist the metadata in PHPCR ODM documents",
Expand All @@ -46,13 +51,23 @@
},
"autoload": {
"psr-4": {
"Symfony\\Cmf\\Bundle\\SonataPhpcrAdminIntegrationBundle\\": "src/",
"Symfony\\Cmf\\Bundle\\SonataPhpcrAdminIntegrationBundle\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Symfony\\Cmf\\Bundle\\SonataPhpcrAdminIntegrationBundle\\Tests\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
}
},
"conflict": {
"sebastian/environment": "<1.3.4",
"sebastian/exporter": "<2.0.0"
},
"minimum-stability": "dev",
"prefer-stable": true
}
42 changes: 12 additions & 30 deletions src/Description/SonataEnhancer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ class SonataEnhancer implements DescriptionEnhancerInterface

private $adminMap = [];

private static $linkKeyMapping = [
'list' => Descriptor::LINK_LIST_HTML,
'create' => Descriptor::LINK_CREATE_HTML,
'edit' => Descriptor::LINK_EDIT_HTML,
'delete' => Descriptor::LINK_REMOVE_HTML,
'show' => Descriptor::LINK_SHOW_HTML,
];

/**
* @param Pool $pool
* @param UrlGeneratorInterface $urlGenerator
Expand All @@ -62,8 +70,6 @@ public function enhance(Description $description)
$class = ClassUtils::getClass($object);
$admin = $this->getAdminByClass($class);

$links = [];

$routeCollection = $admin->getRoutes();

foreach ($routeCollection->getElements() as $code => $route) {
Expand All @@ -72,34 +78,10 @@ public function enhance(Description $description)
$admin->getIdParameter() => $admin->getUrlsafeIdentifier($object),
], true);

$routeRole = substr($code, strlen($admin->getCode()) + 1);

$links[$routeRole] = $url;
}

if (isset($links['list'])) {
$description->set('list', $links['list']);
unset($links['list']);
}

if (isset($links['create'])) {
$description->set(Descriptor::LINK_CREATE_HTML, $links['create']);
unset($links['create']);
}

if (isset($links['edit'])) {
$description->set(Descriptor::LINK_EDIT_HTML, $links['edit']);
unset($links['edit']);
}

if (isset($links['delete'])) {
$description->set(Descriptor::LINK_REMOVE_HTML, $links['delete']);
unset($links['delete']);
}

if (isset($links['show'])) {
$description->set(Descriptor::LINK_SHOW_HTML, $links['show']);
unset($links['show']);
$linkKey = trim($code, '.)');
if (array_key_exists($linkKey, self::$linkKeyMapping)) {
$description->set(self::$linkKeyMapping[$linkKey], $url);
}
}

$description->set(Descriptor::PAYLOAD_TITLE, $admin->toString($object));
Expand Down
3 changes: 2 additions & 1 deletion src/Resources/config/block-menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<service
id="cmf_sonata_phpcr_admin_integration.block.menu_admin"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Block\MenuBlockAdmin"
parent="cmf_sonata_phpcr_admin_integration.abstract_admin">
parent="cmf_sonata_phpcr_admin_integration.abstract_admin"
public="true">
<tag
name="sonata.admin"
manager_type="doctrine_phpcr"
Expand Down
21 changes: 14 additions & 7 deletions src/Resources/config/block.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

<service
id="cmf_sonata_phpcr_admin_integration.block.admin_extension.cache"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Block\Extension\BlockCacheExtension">
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Block\Extension\BlockCacheExtension"
public="true">
<argument>%cmf_sonata_phpcr_admin_integration.block.extension.block_cache.form_group%</argument>
<argument>%cmf_sonata_phpcr_admin_integration.block.extension.block_cache.form_tab%</argument>
<tag name="sonata.admin.extension"/>
Expand All @@ -17,7 +18,8 @@
<service
id="cmf_sonata_phpcr_admin_integration.block.simple_admin"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Block\SimpleBlockAdmin"
parent="cmf_sonata_phpcr_admin_integration.abstract_admin">
parent="cmf_sonata_phpcr_admin_integration.abstract_admin"
public="true">
<tag
name="sonata.admin"
manager_type="doctrine_phpcr"
Expand All @@ -41,7 +43,8 @@
<service
id="cmf_sonata_phpcr_admin_integration.block.action_admin"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Block\ActionBlockAdmin"
parent="cmf_sonata_phpcr_admin_integration.abstract_admin">
parent="cmf_sonata_phpcr_admin_integration.abstract_admin"
public="true">
<tag
name="sonata.admin"
manager_type="doctrine_phpcr"
Expand All @@ -65,7 +68,8 @@
<service
id="cmf_sonata_phpcr_admin_integration.block.container_admin"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Block\ContainerBlockAdmin"
parent="cmf_sonata_phpcr_admin_integration.abstract_admin">
parent="cmf_sonata_phpcr_admin_integration.abstract_admin"
public="true">
<tag
name="sonata.admin"
manager_type="doctrine_phpcr"
Expand All @@ -89,7 +93,8 @@
<service
id="cmf_sonata_phpcr_admin_integration.block.reference_admin"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Block\ReferenceBlockAdmin"
parent="cmf_sonata_phpcr_admin_integration.abstract_admin">
parent="cmf_sonata_phpcr_admin_integration.abstract_admin"
public="true">
<tag
name="sonata.admin"
manager_type="doctrine_phpcr"
Expand All @@ -113,7 +118,8 @@
<service
id="cmf_sonata_phpcr_admin_integration.block.string_admin"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Block\StringBlockAdmin"
parent="cmf_sonata_phpcr_admin_integration.abstract_admin">
parent="cmf_sonata_phpcr_admin_integration.abstract_admin"
public="true">
<tag
name="sonata.admin"
manager_type="doctrine_phpcr"
Expand All @@ -137,7 +143,8 @@
<service
id="cmf_sonata_phpcr_admin_integration.block.slideshow_admin"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Block\SlideshowBlockAdmin"
parent="cmf_sonata_phpcr_admin_integration.abstract_admin">
parent="cmf_sonata_phpcr_admin_integration.abstract_admin"
public="true">
<tag
name="sonata.admin"
manager_type="doctrine_phpcr"
Expand Down
3 changes: 2 additions & 1 deletion src/Resources/config/content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<service
id="cmf_sonata_phpcr_admin_integration.content.admin"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Content\StaticContentAdmin"
parent="cmf_sonata_phpcr_admin_integration.abstract_admin">
parent="cmf_sonata_phpcr_admin_integration.abstract_admin"
public="true">
<tag
name="sonata.admin"
manager_type="doctrine_phpcr"
Expand Down
6 changes: 3 additions & 3 deletions src/Resources/config/core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<service
id="cmf_sonata_phpcr_admin_integration.core.extension.child"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Core\Extension\ChildExtension"
public="false">
public="true">
<tag name="sonata.admin.extension"/>
</service>

<service
id="cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.publishable"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Core\Extension\PublishableExtension"
public="false">
public="true">
<argument>%cmf_sonata_phpcr_admin_integration.core.extension.publishable.form_group%</argument>
<argument>%cmf_sonata_phpcr_admin_integration.core.extension.publishable.form_tab%</argument>
<tag name="sonata.admin.extension"/>
Expand All @@ -25,7 +25,7 @@
<service
id="cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.time_period"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Core\Extension\PublishTimePeriodExtension"
public="false">
public="true">
<argument>%cmf_sonata_phpcr_admin_integration.core.extension.publish_time.form_group%</argument>
<argument>%cmf_sonata_phpcr_admin_integration.core.extension.publish_time.form_tab%</argument>
<tag name="sonata.admin.extension"/>
Expand Down
12 changes: 8 additions & 4 deletions src/Resources/config/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<service
id="cmf_sonata_phpcr_admin_integration.menu.menu_admin"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Menu\MenuAdmin"
parent="cmf_sonata_phpcr_admin_integration.abstract_admin">
parent="cmf_sonata_phpcr_admin_integration.abstract_admin"
public="true">
<tag
name="sonata.admin"
manager_type="doctrine_phpcr"
Expand Down Expand Up @@ -39,7 +40,8 @@
<service
id="cmf_sonata_phpcr_admin_integration.menu.node_admin"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Menu\MenuNodeAdmin"
parent="cmf_sonata_phpcr_admin_integration.abstract_admin">
parent="cmf_sonata_phpcr_admin_integration.abstract_admin"
public="true">
<tag
name="sonata.admin"
manager_type="doctrine_phpcr"
Expand Down Expand Up @@ -72,15 +74,17 @@

<service
id="cmf_sonata_phpcr_admin_integration.menu.extension.menu_node_referrers"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Menu\Extension\MenuNodeReferrersExtension">
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Menu\Extension\MenuNodeReferrersExtension"
public="true">
<argument>%cmf_sonata_phpcr_admin_integration.menu.extension.menu_node_referrers.form_group%</argument>
<argument>%cmf_sonata_phpcr_admin_integration.menu.extension.menu_node_referrers.form_tab%</argument>
<tag name="sonata.admin.extension"/>
</service>

<service
id="cmf_sonata_phpcr_admin_integration.menu.extension.menu_options"
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Menu\Extension\MenuOptionsExtension">
class="Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Menu\Extension\MenuOptionsExtension"
public="true">
<argument>%cmf_sonata_phpcr_admin_integration.menu.extension.menu_options.form_group%</argument>
<argument>%cmf_sonata_phpcr_admin_integration.menu.extension.menu_options.form_tab%</argument>
<argument>%cmf_sonata_phpcr_admin_integration.menu.extension.menu_options.advanced%</argument>
Expand Down
Loading

0 comments on commit 053acda

Please sign in to comment.