Skip to content
Browse files

Fix coding standards and some mistakes

  • Loading branch information...
1 parent 4ea05ac commit 6432345181b3ee2ef7d388ed4ca5789296437121 Jérémy Jourdin committed
Showing with 11 additions and 14 deletions.
  1. +4 −3 ManagerConfigurator.php
  2. +7 −11 Tests/DependencyInjection/AbstractDoctrineExtensionTest.php
View
7 ManagerConfigurator.php
@@ -15,6 +15,7 @@
namespace Doctrine\Bundle\DoctrineBundle;
use Doctrine\ORM\EntityManager;
+use Doctrine\ORM\Query\Filter\SQLFilter;
/**
* Configurator for an EntityManager
@@ -63,7 +64,7 @@ private function enableFilters(EntityManager $entityManager)
$filterCollection = $entityManager->getFilters();
foreach ($this->enabledFilters as $filter) {
$filterObject = $filterCollection->enable($filter);
- if( null !== $filterObject ) {
+ if (null !== $filterObject) {
$this->setFilterParameters($filter, $filterObject);
}
}
@@ -73,11 +74,11 @@ private function enableFilters(EntityManager $entityManager)
* Set defaults parameters for a given filter
*
* @param string $name Filter name
- * @param object $filter Filter object
+ * @param SQLFilter $filter Filter object
*
* @return null
*/
- private function setFilterParameters($name, $filter)
+ private function setFilterParameters($name, SQLFilter $filter)
{
if( !empty($this->filtersParameters[$name]) ) {
$parameters = $this->filtersParameters[$name];
View
18 Tests/DependencyInjection/AbstractDoctrineExtensionTest.php
@@ -882,28 +882,24 @@ protected function assertDICDefinitionMethodCallOnce($definition, $methodName, a
}
}
- protected function assertDICDefinitionMethodCallCount($definition, $methodName, array $params = null, $nbCalls=1)
+ protected function assertDICDefinitionMethodCallCount($definition, $methodName, array $params = array(), $nbCalls=1)
{
$calls = $definition->getMethodCalls();
$called = 0;
foreach ($calls as $call) {
if ($call[0] == $methodName) {
- if ($called > $nbCalls) { break; }
- else {
- if ($params[$called] !== null) {
+ if ($called > $nbCalls) {
+ break;
+ } else {
+ if (isset($params[$called])) {
$this->assertEquals($params[$called], $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters.");
}
$called++;
}
}
}
- if($called != $nbCalls) {
- if ( $called == 0) {
- $this->fail("Method '".$methodName."' is expected to be called ". $nbCalls ." time, definition does not contain a call though.");
- } else {
- $this->fail("Method '".$methodName."' is expected to be called ". $nbCalls ." time, definition contain ". $called ." calls.");
- }
- }
+
+ $this->assertEquals($nbCalls, $called, sprintf('The method "%s" should be called %d times', $methodName, $nbCalls));
}

0 comments on commit 6432345

Please sign in to comment.
Something went wrong with that request. Please try again.