Browse Source

Fixed some typos. Added assertion for unload return result.

Robert Pustułka 9 years ago
parent
commit
d59ba45ab6
1 changed files with 7 additions and 6 deletions
  1. 7 6
      tests/TestCase/Controller/ComponentRegistryTest.php

+ 7 - 6
tests/TestCase/Controller/ComponentRegistryTest.php

@@ -201,9 +201,10 @@ class ComponentRegistryTest extends TestCase
     {
         $eventManager = $this->Components->getController()->getEventManager();
 
-        $result = $this->Components->load('Auth');
-        $this->Components->unload('Auth');
+        $this->Components->load('Auth');
+        $result = $this->Components->unload('Auth');
 
+        $this->assertSame($this->Components, $result);
         $this->assertFalse(isset($this->Components->Auth), 'Should be gone');
         $this->assertCount(0, $eventManager->listeners('Controller.startup'));
     }
@@ -213,11 +214,11 @@ class ComponentRegistryTest extends TestCase
      *
      * @return void
      */
-    public function testUset()
+    public function testUnset()
     {
         $eventManager = $this->Components->getController()->getEventManager();
 
-        $result = $this->Components->load('Auth');
+        $this->Components->load('Auth');
         unset($this->Components->Auth);
 
         $this->assertFalse(isset($this->Components->Auth), 'Should be gone');
@@ -250,7 +251,7 @@ class ComponentRegistryTest extends TestCase
         $result = $this->Components->set('Auth', $auth);
 
         $this->assertSame($this->Components, $result);
-        $this->assertTrue(isset($this->Components->Auth), 'Should be gone');
+        $this->assertTrue(isset($this->Components->Auth), 'Should be present');
         $this->assertCount(1, $eventManager->listeners('Controller.startup'));
     }
 
@@ -267,7 +268,7 @@ class ComponentRegistryTest extends TestCase
         $auth = new AuthComponent($this->Components);
         $this->Components->Auth = $auth;
 
-        $this->assertTrue(isset($this->Components->Auth), 'Should be gone');
+        $this->assertTrue(isset($this->Components->Auth), 'Should be present');
         $this->assertCount(1, $eventManager->listeners('Controller.startup'));
     }