Skip to content

Commit

Permalink
Removing tests that have been implemented elsewhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 11, 2010
1 parent 74a1294 commit 62d646d
Showing 1 changed file with 0 additions and 142 deletions.
142 changes: 0 additions & 142 deletions cake/tests/cases/libs/controller/component.test.php
Expand Up @@ -333,59 +333,6 @@ function testInnerComponentConstruction() {
$this->assertType('OrangeComponent', $Component->Orange, 'class is wrong');
}

/**
* testLoadComponents method
*
* @access public
* @return void
*/
function testLoadComponents() {
$this->markTestSkipped('init() will be removed from Component');

$Controller =& new ComponentTestController();
$Controller->components = array('RequestHandler');

$Component =& new Component();
$Component->init($Controller);

$this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent'));

$Controller =& new ComponentTestController();
$Controller->plugin = 'test_plugin';
$Controller->components = array('RequestHandler', 'TestPluginComponent');

$Component =& new Component();
$Component->init($Controller);

$this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent'));
$this->assertTrue(is_a($Controller->TestPluginComponent, 'TestPluginComponentComponent'));
$this->assertTrue(is_a(
$Controller->TestPluginComponent->TestPluginOtherComponent,
'TestPluginOtherComponentComponent'
));
$this->assertFalse(isset($Controller->TestPluginOtherComponent));

$Controller =& new ComponentTestController();
$Controller->components = array('Security');

$Component =& new Component();
$Component->init($Controller);

$this->assertTrue(is_a($Controller->Security, 'SecurityComponent'));
$this->assertTrue(is_a($Controller->Security->Session, 'SessionComponent'));

$Controller =& new ComponentTestController();
$Controller->components = array('Security', 'Cookie', 'RequestHandler');

$Component =& new Component();
$Component->init($Controller);

$this->assertTrue(is_a($Controller->Security, 'SecurityComponent'));
$this->assertTrue(is_a($Controller->Security->RequestHandler, 'RequestHandlerComponent'));
$this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent'));
$this->assertTrue(is_a($Controller->Cookie, 'CookieComponent'));
}

/**
* test component loading
*
Expand Down Expand Up @@ -431,95 +378,6 @@ function testMultipleComponentInitialize() {
$this->assertSame($Banana->testField, $Orange->Banana->testField, 'References are broken');
}

/**
* Test Component declarations with Parameters
* tests merging of component parameters and merging / construction of components.
*
* @return void
*/
function testComponentsWithParams() {
if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
return;
}
$this->markTestSkipped('MergeVars test covers this.');

$Controller =& new ComponentTestController();
$Controller->components = array('ParamTest' => array('test' => 'value', 'flag'), 'Apple');
$Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);

$this->assertTrue(is_a($Controller->ParamTest, 'ParamTestComponent'));
$this->assertTrue(is_a($Controller->ParamTest->Banana, 'BananaComponent'));
$this->assertTrue(is_a($Controller->Orange, 'OrangeComponent'));
$this->assertFalse(isset($Controller->Session));
$this->assertEqual($Controller->Orange->settings, array('colour' => 'blood orange'));
$this->assertEqual($Controller->ParamTest->test, 'value');
$this->assertEqual($Controller->ParamTest->flag, true);

//Settings are merged from app controller and current controller.
$Controller =& new ComponentTestController();
$Controller->components = array(
'ParamTest' => array('test' => 'value'),
'Orange' => array('ripeness' => 'perfect')
);
$Controller->constructClasses();
$Controller->Component->initialize($Controller);

$expected = array('colour' => 'blood orange', 'ripeness' => 'perfect');
$this->assertEqual($Controller->Orange->settings, $expected);
$this->assertEqual($Controller->ParamTest->test, 'value');
}

/**
* Ensure that settings are not duplicated when passed into component initialize.
*
* @return void
*/
function testComponentParamsNoDuplication() {
if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
return;
}
$this->markTestSkipped('MergeVars test covers this.');

$Controller =& new ComponentTestController();
$Controller->components = array('Orange' => array('setting' => array('itemx')));
$Controller->uses = false;

$Controller->constructClasses();
$Controller->Component->initialize($Controller);
$expected = array('setting' => array('itemx'), 'colour' => 'blood orange');
$this->assertEqual($Controller->Orange->settings, $expected, 'Params duplication has occured %s');
}

/**
* Test mutually referencing components.
*
* @return void
*/
function testMutuallyReferencingComponents() {
$this->markTestSkipped('ComponentCollection handles this');

$Controller =& new ComponentTestController();
$Controller->components = array('MutuallyReferencingOne');
$Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);

$this->assertTrue(is_a(
$Controller->MutuallyReferencingOne,
'MutuallyReferencingOneComponent'
));
$this->assertTrue(is_a(
$Controller->MutuallyReferencingOne->MutuallyReferencingTwo,
'MutuallyReferencingTwoComponent'
));
$this->assertTrue(is_a(
$Controller->MutuallyReferencingOne->MutuallyReferencingTwo->MutuallyReferencingOne,
'MutuallyReferencingOneComponent'
));
}

/**
* Test mutually referencing components.
*
Expand Down

0 comments on commit 62d646d

Please sign in to comment.