/** * Test mutually referencing components. * * @return void */ public function testSomethingReferencingEmailComponent() { $Controller = new ComponentTestController(); $Controller->components = array('SomethingWithEmail'); $Controller->uses = false; $Controller->constructClasses(); $Controller->Components->trigger('initialize', array(&$Controller)); $Controller->beforeFilter(); $Controller->Components->trigger('startup', array(&$Controller)); $this->assertInstanceOf('SomethingWithEmailComponent', $Controller->SomethingWithEmail); $this->assertInstanceOf('EmailComponent', $Controller->SomethingWithEmail->Email); }
/** * Test that SessionComponent doesn't get added if its already in the components array. * * @return void * @access public */ function testDoubleLoadingOfSessionComponent() { if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) { return; } $Controller = new ComponentTestController(); $Controller->uses = false; $Controller->components = array('Session'); $Controller->constructClasses(); $this->assertEqual($Controller->components, array('Session' => '', 'Orange' => array('colour' => 'blood orange'))); }