Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

a test in the MootoolsEngineHelper testcase was ignoring asserts #196

Closed
wants to merge 1 commit into from

2 participants

@jellehenkens

In the test for MootoolsEngineHelper::drop() there is a expectError(). Because of this assert the asserts on the next lines are never run and never tests the actual drop() function.

I fixed this by splitting them up and moving the error checking assert into its own test function.

@markstory
Owner

Thanks for the patch. expectError should probably be removed from all the tests in 2.0. The PHPUnit annotations are much better for this use.

@jellehenkens

What about the idea of helpers throwing exceptions?

This function could throw a MissingParameterException

@markstory
Owner

I think an exception here makes sense.

@markstory
Owner

Landed in [aa45452]. I left the trigger_error as is for now, but it could be an exception.

@markstory markstory closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 8, 2011
  1. @jellehenkens
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 3 deletions.
  1. +11 −3 lib/Cake/Test/Case/View/Helper/MootoolsEngineHelperTest.php
View
14 lib/Cake/Test/Case/View/Helper/MootoolsEngineHelperTest.php
@@ -263,12 +263,13 @@ public function testDrag() {
$expected = '$("drag-me").makeDraggable({onComplete:onStop, onDrag:onDrag, onStart:onStart, snap:[10,10]});';
$this->assertEqual($expected, $result);
}
+
/**
- * test drop() method
+ * test drop() method with the required drag option missing
*
* @return void
*/
- public function testDrop() {
+ public function testDropWithMissingOption() {
$this->expectError();
$this->Moo->get('#drop-me');
$this->Moo->drop(array(
@@ -276,7 +277,14 @@ public function testDrop() {
'leave' => 'onLeave',
'hover' => 'onHover',
));
-
+ }
+/**
+ * test drop() method
+ *
+ * @return void
+ */
+ public function testDrop() {
+ $this->Moo->get('#drop-me');
$result = $this->Moo->drop(array(
'drop' => 'onDrop',
'leave' => 'onLeave',
Something went wrong with that request. Please try again.