-
Notifications
You must be signed in to change notification settings - Fork 45
Bundle standards #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bundle standards #52
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Tests/Resources/app/cache | ||
Tests/Resources/app/logs | ||
composer.lock | ||
vendor |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
language: php | ||
|
||
php: | ||
- 5.3 | ||
- 5.4 | ||
- 5.5 | ||
|
||
env: | ||
- SYMFONY_VERSION=2.2.* | ||
- SYMFONY_VERSION=2.3.* | ||
|
||
before_script: | ||
- composer require symfony/framework-bundle:${SYMFONY_VERSION} | ||
- vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh | ||
|
||
script: phpunit --coverage-text | ||
|
||
notifications: | ||
irc: "irc.freenode.org#symfony-cmf" | ||
email: "[email protected]" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ public function getConfigTreeBuilder() | |
->fixXmlConfig('controller_by_alias', 'controllers_by_alias') | ||
->fixXmlConfig('controller_by_class', 'controllers_by_class') | ||
->fixXmlConfig('template_by_class', 'templates_by_class') | ||
->addDefaultsIfNotSet() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we want that? its a change in behaviour in case you want to disable something There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, the DI extension uses keys from Not sure I see why its bad, although I can certainly see a case for tidying up the DI extension, its a bit chaotic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok with your change then. |
||
->children() | ||
->scalarNode('content_repository_id')->defaultValue('cmf_routing.content_repository')->end() | ||
->scalarNode('uri_filter_regexp')->defaultValue('')->end() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,11 @@ | |
use Doctrine\Bundle\PHPCRBundle\Migrator\MigratorInterface; | ||
use Doctrine\ODM\PHPCR\DocumentManager; | ||
|
||
/** | ||
* Doctrine migrator for pages | ||
* | ||
* Provides a way of creating and maintaining pages from YAML files. | ||
*/ | ||
class Page implements MigratorInterface | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is a bit of doc here http://symfony.com/doc/current/cmf/getting_started/installing_symfony_cmf.html#adding-new-pages |
||
{ | ||
/** | ||
|
@@ -131,4 +136,4 @@ public function migrate($path = '/', $depth = -1) | |
|
||
return 0; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,40 @@ | ||
# Symfony Cmf Simple CMS Bundle | ||
# Symfony CMF SimpleCms Bundle | ||
|
||
[](http://travis-ci.org/symfony-cmf/SimpleCmsBundle) | ||
[](https://packagist.org/packages/symfony-cmf/simple-cms-bundle) | ||
[](https://packagist.org/packages/symfony-cmf/simple-cms-bundle) | ||
|
||
This bundle is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) | ||
and licensed under the [MIT License](LICENSE). | ||
|
||
A trivial content management system based on the [Symfony Cmf](https://github.com/symfony-cmf/symfony-cmf) | ||
|
||
## Links | ||
## Requirements | ||
|
||
- GitHub: <https://github.com/symfony-cmf/symfony-cmf> | ||
- Sandbox: <https://github.com/symfony-cmf/cmf-sandbox> | ||
- Web: <http://cmf.symfony.com/> | ||
- Uncyclo: <http://github.com/symfony-cmf/symfony-cmf/wiki> | ||
- Issue Tracker: <http://cmf.symfony-project.org/redmine/> | ||
- IRC: irc://freenode/#symfony-cmf | ||
- Users mailing list: <http://groups.google.com/group/symfony-cmf-users> | ||
- Devs mailing list: <http://groups.google.com/group/symfony-cmf-devs> | ||
* Symfony 2.2.x | ||
* See also the `require` section of [composer.json](composer.json) | ||
|
||
## Documentation | ||
|
||
http://symfony.com/doc/master/cmf/getting_started/simplecms.html | ||
For the install guide and reference, see: | ||
|
||
* [SimpleCmsBundle documentation](http://symfony.com/doc/master/cmf/bundles/simple-cms-bundle.html) | ||
|
||
See also: | ||
|
||
* [All Symfony CMF documentation](http://symfony.com/doc/master/cmf/index.html)- complete Symfony CMF reference | ||
* [Symfony CMF Website](http://cmf.symfony.com/) - introduction, live demo, support and community links | ||
|
||
|
||
## Contributing | ||
|
||
Pull requests are welcome. Please see our | ||
[CONTRIBUTING](https://github.com/symfony-cmf/SimpleCmsBundle/blob/master/CONTRIBUTING.md) | ||
guide. | ||
|
||
Unit and/or functional tests exist for this bundle. See the | ||
[Testing documentation](http://symfony.com/doc/master/cmf/components/testing.html) | ||
for a guide to running the tests. | ||
|
||
Thanks to | ||
[everyone who has contributed](https://github.com/symfony-cmf/SimpleCmsBundle/contributors) already. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace Symfony\Cmf\Bundle\SimpleCmsBundle\Tests\Resources\DataFixtures\Phpcr; | ||
|
||
use Doctrine\Common\DataFixtures\FixtureInterface; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
use Doctrine\Common\DataFixtures\DependentFixtureInterface; | ||
use Doctrine\ODM\PHPCR\Document\Generic; | ||
use Symfony\Cmf\Bundle\SimpleCmsBundle\Document\Page; | ||
|
||
class LoadPageData implements FixtureInterface, DependentFixtureInterface | ||
{ | ||
public function getDependencies() | ||
{ | ||
return array( | ||
'Symfony\Cmf\Component\Testing\DataFixtures\PHPCR\LoadBaseData', | ||
); | ||
} | ||
|
||
public function load(ObjectManager $manager) | ||
{ | ||
$root = $manager->find(null, '/test'); | ||
$base = new Generic; | ||
$base->setNodename('page'); | ||
$base->setParent($root); | ||
$manager->persist($base); | ||
|
||
$page = new Page; | ||
$page->setName('homepage'); | ||
$page->setTitle('Homepage'); | ||
$page->setLabel('homepage'); | ||
$page->setPublishable(true); | ||
$page->setParent($base); | ||
|
||
$manager->persist($page); | ||
|
||
$manager->flush(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
use Symfony\Cmf\Component\Testing\HttpKernel\TestKernel; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
|
||
class AppKernel extends TestKernel | ||
{ | ||
public function configure() | ||
{ | ||
$this->requireBundleSets(array( | ||
'default', | ||
'phpcr_odm', | ||
'sonata_admin', | ||
)); | ||
|
||
$this->addBundles(array( | ||
new \Symfony\Cmf\Bundle\SimpleCmsBundle\CmfSimpleCmsBundle(), | ||
new \Symfony\Cmf\Bundle\MenuBundle\CmfMenuBundle(), | ||
new \Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(), | ||
new \Symfony\Cmf\Bundle\CoreBundle\CmfCoreBundle(), | ||
)); | ||
} | ||
|
||
public function registerContainerConfiguration(LoaderInterface $loader) | ||
{ | ||
$loader->load(__DIR__.'/config/config.php'); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" ?> | ||
<container xmlns="http://symfony.com/schema/dic/services"> | ||
|
||
<config xmlns="http://cmf.symfony.com/schema/dic/simplecms" | ||
basepath="/test/page" | ||
> | ||
</config> | ||
|
||
</container> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
|
||
$loader->import(CMF_TEST_CONFIG_DIR.'/default.php'); | ||
$loader->import(CMF_TEST_CONFIG_DIR.'/phpcr_odm.php'); | ||
$loader->import(CMF_TEST_CONFIG_DIR.'/sonata_admin.php'); | ||
$loader->import(__DIR__.'/cmf_simple_cms.xml'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
use Symfony\Component\Routing\RouteCollection; | ||
|
||
$collection = new RouteCollection(); | ||
$collection->addCollection( | ||
$loader->import(CMF_TEST_CONFIG_DIR.'/routing/sonata_routing.yml') | ||
); | ||
//$collection->addCollection( | ||
// $loader->import(__DIR__.'/routing/my_test_routing.yml') | ||
//); | ||
|
||
return $collection; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
namespace Symfony\Cmf\Bundle\SimpleCmsBundle\Tests\WebTest\Admin; | ||
|
||
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase; | ||
|
||
class PageAdminTest extends BaseTestCase | ||
{ | ||
public function setUp() | ||
{ | ||
$this->db('PHPCR')->loadFixtures(array( | ||
'Symfony\Cmf\Bundle\SimpleCmsBundle\Tests\Resources\DataFixtures\Phpcr\LoadPageData', | ||
)); | ||
$this->client = $this->createClient(); | ||
} | ||
|
||
public function testPageList() | ||
{ | ||
$crawler = $this->client->request('GET', '/admin/cmf/simplecms/page/list'); | ||
$res = $this->client->getResponse(); | ||
$this->assertEquals(200, $res->getStatusCode()); | ||
$this->assertCount(1, $crawler->filter('html:contains("homepage")')); | ||
} | ||
|
||
public function testPageEdit() | ||
{ | ||
$crawler = $this->client->request('GET', '/admin/cmf/simplecms/page/test/pages/homepage/edit'); | ||
$res = $this->client->getResponse(); | ||
$this->assertEquals(200, $res->getStatusCode()); | ||
$this->assertCount(1, $crawler->filter('input[value="homepage"]')); | ||
} | ||
|
||
public function testPageShow() | ||
{ | ||
return; | ||
$crawler = $this->client->request('GET', '/admin/cmf/simplecms/page/test/pages/homepage/show'); | ||
$res = $this->client->getResponse(); | ||
$this->assertEquals(200, $res->getStatusCode()); | ||
$this->assertCount(2, $crawler->filter('td:contains("test-page")')); | ||
} | ||
|
||
public function testPageCreate() | ||
{ | ||
$crawler = $this->client->request('GET', '/admin/cmf/simplecms/page/create'); | ||
$res = $this->client->getResponse(); | ||
$this->assertEquals(200, $res->getStatusCode()); | ||
|
||
$button = $crawler->selectButton('Create'); | ||
$form = $button->form(); | ||
$node = $form->getFormNode(); | ||
$actionUrl = $node->getAttribute('action'); | ||
$uniqId = substr(strchr($actionUrl, '='), 1); | ||
|
||
$form[$uniqId.'[parent]'] = '/test/pages'; | ||
$form[$uniqId.'[title]'] = 'foo-page'; | ||
$form[$uniqId.'[label]'] = 'Foo Page'; | ||
|
||
$this->client->submit($form); | ||
$res = $this->client->getResponse(); | ||
|
||
// If we have a 302 redirect, then all is well | ||
$this->assertEquals(302, $res->getStatusCode()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this. Should we keep it? What is the intention of
sidemenu.publish_start_end_date
and the other one? /cc @lsmith77There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was a quick hack to add a preview link and also give some documentation on the logic behind the publish workflow. the later part should now be moved to the admin extension somehow. the former is something we really should figure out. we could create a form widget that just lists all the pages that are linked to the given content directly or indirectly (ie. f.e. for a block it would find what content is linked to the block and from there figure out the routes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would be this issue i think:
sonata-project/SonataDoctrinePhpcrAdminBundle#116
i wonder if we really should build that right into sonata, with an
optional dependeny on CmfRoutingBundle or if we could for example
provide an extension for this. but not sure if extensions can add to the
sidebar...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So are we alright to leave this out for now if we have that issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i added a link to the changes here in the sonata issue about the preview link.
i don't really understand what the publish workflow thingy was about, if it just was doing documentation. @lsmith77 can you create an issue on the corebundle if we should add something to the publish workflow admin extensions? maybe providing the label and the help text in the form would be enough?
lets merge this PR, the publish workflow things are already displaying broken, so it seems not too important to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, btw there is already -some- help text: http://cmf.liip.ch/en/admin/bundle/simplecms/page/cms/simple/service/contact/edit#s51ffb1ad3a7e1_2