Skip to content

Commit

Permalink
Fixed some typos. Added assertion for unload return result.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Pustułka committed May 9, 2017
1 parent a5dfca6 commit d59ba45
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/TestCase/Controller/ComponentRegistryTest.php
Expand Up @@ -201,9 +201,10 @@ public function testUnload()
{
$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'));
}
Expand All @@ -213,11 +214,11 @@ public function testUnload()
*
* @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');
Expand Down Expand Up @@ -250,7 +251,7 @@ public function testSet()
$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'));
}

Expand All @@ -267,7 +268,7 @@ public function testMagicSet()
$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'));
}

Expand Down

0 comments on commit d59ba45

Please sign in to comment.