Permalink
Browse files

Fix massive performance issue with asserting (everything) is a bool

  • Loading branch information...
1 parent ce6bd02 commit 88e2edb4990ba61a83fd7cf9238ab8a9ac3f89c6 @CloCkWeRX CloCkWeRX committed Dec 12, 2011
Showing with 13 additions and 12 deletions.
  1. +1 −1 HTML/Progress2.php
  2. +12 −11 tests/HTML_Progress2Test.php
View
@@ -3280,7 +3280,7 @@ function addListener($callback, $nName = EVENT_DISPATCHER_GLOBAL)
'paramnum' => 2));
}
- $this->dispatcher =& Event_Dispatcher::getInstance('ProgressMeter');
+ $this->dispatcher = Event_Dispatcher::getInstance('ProgressMeter');
$this->dispatcher->addObserver($callback, $nName);
$this->_observerCount++;
@@ -190,7 +190,9 @@ function test_moveStep()
if (!$this->_methodExists('moveStep')) {
return;
}
+ ob_start();
$this->progress->moveStep(15);
+ ob_end_clean();
}
@@ -266,9 +268,10 @@ function test_addListener()
return;
}
- $monitor = $this->progress->addListener(new log_progress());
+ $progress = new log_progress();
+ $this->progress->addListener(array($progress, 'log_progress'));
- $this->assertTrue($monitor, $observer .' is not a valid listener ');
+ $this->_getResult();
}
@@ -424,8 +427,7 @@ function test_removeListener_fail_no_class()
if (!$this->_methodExists('removeListener')) {
return;
}
- $observer = 'log_progress2';
- $result = $this->progress->removeListener(new $observer);
+ $result = $this->progress->removeListener(array());
$this->assertTrue($result instanceof HTML_Progress2_Error);
$this->assertSame(HTML_PROGRESS2_ERROR_INVALID_CALLBACK, $result->getCode());
@@ -436,11 +438,11 @@ function test_removeListener()
if (!$this->_methodExists('removeListener')) {
return;
}
- $observer = 'logit2';
- $monitor = $this->progress->addListener(new $observer);
- $monitor = $this->progress->removeListener(new $observer);
+ $observer = new logit2;
+ $this->progress->addListener(array($observer, 'logit2'));
+ $this->progress->removeListener(array($observer, 'logit2'));
- $this->assertTrue($monitor, $observer .' is not a valid listener or is not yet attached ');
+ $this->_getResult();
}
/**
@@ -1036,7 +1038,7 @@ function test_setProgressHandler()
}
}
-require_once ('HTML/Progress2/Observer.php');
+require_once 'HTML/Progress2/Observer.php';
/**
* @ignore
*/
@@ -1068,5 +1070,4 @@ function logit2()
*/
class log_progress2
{
-}
-?>
+}

0 comments on commit 88e2edb

Please sign in to comment.