Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added separator to model in renderPartial function #5080

Closed
wants to merge 3 commits into from

4 participants

@serpent7776

No description provided.

@weierophinney

Please add unit tests for this new feature.

@serpent7776 serpent7776 Change to ModuleManager to accept null modules
Changed ModuleManager so I can use statements in application.config.php file like:

return array(
	'Application',
	$env=='dev' ? 'ZendDeveloperTools' : null
)

Null modules are silently ignored.
ed00177
library/Zend/ModuleManager/ModuleManager.php
@@ -78,6 +78,7 @@ public function onLoadModules()
}
foreach ($this->getModules() as $moduleName => $module) {
+ if ($module == null) continue;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@serpent7776 serpent7776 Added unit tests
Changed source to conform to Zend coding standards
02c9120
@weierophinney weierophinney commented on the diff
tests/ZendTest/ModuleManager/ModuleManagerTest.php
@@ -89,6 +89,17 @@ public function testCanLoadSomeModule()
$this->assertSame($config->some, 'thing');
}
+ public function testIgnoreNullModule()
+ {
+ $configListener = $this->defaultListeners->getConfigListener();
+ $moduleManager = new ModuleManager(array('SomeModule', null), new EventManager);
+ $moduleManager->getEventManager()->attachAggregate($this->defaultListeners);
+ $moduleManager->loadModules();
+ $loadedModules = $moduleManager->getLoadedModules();
+ $this->assertInstanceOf('SomeModule\Module', $loadedModules['SomeModule']);
+ $this->assertSame(count($loadedModules), 1);
+ }
+
@weierophinney Owner

What do the module manager commits have to do with this? Please remove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@weierophinney weierophinney referenced this pull request from a commit
@weierophinney weierophinney [#5080] Revert ModuleManager changes
- outside stated scope of issue/pull request.
9253d49
@weierophinney weierophinney referenced this pull request from a commit
@weierophinney weierophinney [#5080] CS fixes
- EOF marker
5541edf
@weierophinney

Merged to develop for release with 2.3.0; removed all ModuleManager-related commits, as they were not in scope with the stated purpose of the pull request. @serpent7776 -- in the future, please create new branches per feature/bugfix, as stated in the contributing guidelines.

@froschdesign

:-1:
This is not needed!

Use in your partial script:

$this->navigation()->breadcrumbs()->getSeparator();
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-modulemanager
@weierophinney weierophinney Merge pull request zendframework/zf2#5080 from serpent7776/master
Added separator to model in renderPartial function
7b3169d
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-modulemanager
@weierophinney weierophinney [zendframework/zf2#5080] Revert ModuleManager changes
- outside stated scope of issue/pull request.
c418c33
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-view
@weierophinney weierophinney Merge pull request zendframework/zf2#5080 from serpent7776/master
Added separator to model in renderPartial function
f5afb50
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-view
@weierophinney weierophinney [zendframework/zf2#5080] CS fixes
- EOF marker
102c7ca
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-view
@weierophinney weierophinney Merge branch 'feature/5080' into develop af68246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 5, 2013
  1. @serpent7776
  2. @serpent7776

    Change to ModuleManager to accept null modules

    serpent7776 authored
    Changed ModuleManager so I can use statements in application.config.php file like:
    
    return array(
    	'Application',
    	$env=='dev' ? 'ZendDeveloperTools' : null
    )
    
    Null modules are silently ignored.
Commits on Sep 6, 2013
  1. @serpent7776

    Added unit tests

    serpent7776 authored
    Changed source to conform to Zend coding standards
This page is out of date. Refresh to see the latest.
View
3  library/Zend/ModuleManager/ModuleManager.php
@@ -78,6 +78,9 @@ public function onLoadModules()
}
foreach ($this->getModules() as $moduleName => $module) {
+ if ($module == null) {
+ continue;
+ }
if (is_object($module)) {
if (!is_string($moduleName)) {
throw new Exception\RuntimeException(sprintf(
View
5 library/Zend/View/Helper/Navigation/Breadcrumbs.php
@@ -172,7 +172,10 @@ public function renderPartial($container = null, $partial = null)
}
// put breadcrumb pages in model
- $model = array('pages' => array());
+ $model = array(
+ 'pages' => array(),
+ 'separator' => $this->getSeparator()
+ );
$active = $this->findActive($container);
if ($active) {
$active = $active['page'];
View
11 tests/ZendTest/ModuleManager/ModuleManagerTest.php
@@ -89,6 +89,17 @@ public function testCanLoadSomeModule()
$this->assertSame($config->some, 'thing');
}
+ public function testIgnoreNullModule()
+ {
+ $configListener = $this->defaultListeners->getConfigListener();
+ $moduleManager = new ModuleManager(array('SomeModule', null), new EventManager);
+ $moduleManager->getEventManager()->attachAggregate($this->defaultListeners);
+ $moduleManager->loadModules();
+ $loadedModules = $moduleManager->getLoadedModules();
+ $this->assertInstanceOf('SomeModule\Module', $loadedModules['SomeModule']);
+ $this->assertSame(count($loadedModules), 1);
+ }
+
@weierophinney Owner

What do the module manager commits have to do with this? Please remove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
public function testCanLoadMultipleModules()
{
$configListener = $this->defaultListeners->getConfigListener();
View
8 tests/ZendTest/View/Helper/Navigation/BreadcrumbsTest.php
@@ -198,6 +198,14 @@ public function testRenderingPartial()
$this->assertEquals($expected, $this->_helper->render());
}
+ public function testRenderingPartialWithSeparator()
+ {
+ $this->_helper->setPartial('bc_separator.phtml')->setSeparator(' / ');
+
+ $expected = $this->_getExpected('bc/partialwithseparator.html');
+ $this->assertEquals($expected, $this->_helper->render());
+ }
+
public function testRenderingPartialBySpecifyingAnArrayAsPartial()
{
$this->_helper->setPartial(array('bc.phtml', 'application'));
View
1  tests/ZendTest/View/Helper/Navigation/_files/expected/bc/partialwithseparator.html
@@ -0,0 +1 @@
+Page 2 / Page 2.3 / Page 2.3.3 / Page 2.3.3.1
View
4 tests/ZendTest/View/Helper/Navigation/_files/mvc/views/bc_separator.phtml
@@ -0,0 +1,4 @@
+<?php
+echo implode($this->vars()->separator, array_map(
+ create_function('$a', 'return $a->getLabel();'),
+ $this->vars()->pages));
Something went wrong with that request. Please try again.