|
|
@@ -132,38 +132,6 @@ class RequestActionController extends Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * RequestActionPersistentController class
|
|
|
- *
|
|
|
- * @package cake.tests.cases.libs
|
|
|
- */
|
|
|
-class RequestActionPersistentController extends Controller {
|
|
|
-
|
|
|
-/**
|
|
|
-* uses property
|
|
|
-*
|
|
|
-* @var array
|
|
|
-* @access public
|
|
|
-*/
|
|
|
- public $uses = array('PersisterOne');
|
|
|
-
|
|
|
-/**
|
|
|
-* persistModel property
|
|
|
-*
|
|
|
-* @var array
|
|
|
-* @access public
|
|
|
-*/
|
|
|
- public $persistModel = true;
|
|
|
-
|
|
|
-/**
|
|
|
- * post pass, testing post passing
|
|
|
- *
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public function index() {
|
|
|
- return 'This is a test';
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
/**
|
|
|
* TestObject class
|
|
|
@@ -298,14 +266,6 @@ class TestObject extends Object {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * testPersist
|
|
|
- *
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function testPersist($name, $return = null, &$object, $type = null) {
|
|
|
- return $this->_persist($name, $return, $object, $type);
|
|
|
- }
|
|
|
-/**
|
|
|
* undocumented function
|
|
|
*
|
|
|
* @return void
|
|
|
@@ -414,184 +374,6 @@ class ObjectTest extends CakeTestCase {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * testPersist method
|
|
|
- *
|
|
|
- * @access public
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function testPersist() {
|
|
|
- $this->markTestIncomplete('Object::persist() is totally broken right now.');
|
|
|
-
|
|
|
- ClassRegistry::flush();
|
|
|
-
|
|
|
- $cacheDisable = Configure::read('Cache.disable');
|
|
|
- Configure::write('Cache.disable', false);
|
|
|
- @unlink(CACHE . 'persistent' . DS . 'testmodel.php');
|
|
|
- $test = new stdClass;
|
|
|
- $this->assertFalse($this->object->testPersist('TestModel', null, $test));
|
|
|
- $this->assertFalse($this->object->testPersist('TestModel', true, $test));
|
|
|
- $this->assertTrue($this->object->testPersist('TestModel', null, $test));
|
|
|
- $this->assertTrue(file_exists(CACHE . 'persistent' . DS . 'testmodel.php'));
|
|
|
- $this->assertTrue($this->object->testPersist('TestModel', true, $test));
|
|
|
- $this->assertEqual($this->object->TestModel, $test);
|
|
|
-
|
|
|
- @unlink(CACHE . 'persistent' . DS . 'testmodel.php');
|
|
|
-
|
|
|
- $model = new ObjectTestModel();
|
|
|
- $expected = ClassRegistry::keys();
|
|
|
-
|
|
|
- ClassRegistry::flush();
|
|
|
- $data = array('object_test_model' => $model);
|
|
|
- $this->assertFalse($this->object->testPersist('ObjectTestModel', true, $data));
|
|
|
- $this->assertTrue(file_exists(CACHE . 'persistent' . DS . 'objecttestmodel.php'));
|
|
|
-
|
|
|
- $this->object->testPersist('ObjectTestModel', true, $model, 'registry');
|
|
|
-
|
|
|
- $result = ClassRegistry::keys();
|
|
|
- $this->assertEqual($expected, $result);
|
|
|
-
|
|
|
- $newModel = ClassRegistry::getObject('object_test_model');
|
|
|
- $this->assertEqual('ObjectTestModel', $newModel->name);
|
|
|
-
|
|
|
- @unlink(CACHE . 'persistent' . DS . 'objecttestmodel.php');
|
|
|
-
|
|
|
- Configure::write('Cache.disable', $cacheDisable);
|
|
|
- }
|
|
|
-
|
|
|
-/**
|
|
|
- * testPersistWithRequestAction method
|
|
|
- *
|
|
|
- * @access public
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function testPersistWithBehavior() {
|
|
|
- $this->markTestIncomplete('Object::persist() is totally broken right now.');
|
|
|
- ClassRegistry::flush();
|
|
|
-
|
|
|
- $cacheDisable = Configure::read('Cache.disable');
|
|
|
- Configure::write('Cache.disable', false);
|
|
|
-
|
|
|
- App::build(array(
|
|
|
- 'models' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS),
|
|
|
- 'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin'. DS),
|
|
|
- 'behaviors' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model'. DS . 'Behavior' . DS),
|
|
|
- ), true);
|
|
|
-
|
|
|
- $this->assertFalse(class_exists('PersisterOneBehaviorBehavior'));
|
|
|
- $this->assertFalse(class_exists('PersisterTwoBehaviorBehavior'));
|
|
|
- $this->assertFalse(class_exists('TestPluginPersisterBehavior'));
|
|
|
- $this->assertFalse(class_exists('TestPluginAuthors'));
|
|
|
-
|
|
|
- $Controller = new RequestActionPersistentController();
|
|
|
- $Controller->persistModel = true;
|
|
|
- $Controller->constructClasses();
|
|
|
-
|
|
|
- $this->assertTrue(file_exists(CACHE . 'persistent' . DS . 'persisterone.php'));
|
|
|
- $this->assertTrue(file_exists(CACHE . 'persistent' . DS . 'persisteroneregistry.php'));
|
|
|
-
|
|
|
- $contents = file_get_contents(CACHE . 'persistent' . DS . 'persisteroneregistry.php');
|
|
|
- $contents = str_replace('"PersisterOne"', '"PersisterTwo"', $contents);
|
|
|
- $contents = str_replace('persister_one', 'persister_two', $contents);
|
|
|
- $contents = str_replace('test_plugin_comment', 'test_plugin_authors', $contents);
|
|
|
- $result = file_put_contents(CACHE . 'persistent' . DS . 'persisteroneregistry.php', $contents);
|
|
|
-
|
|
|
- $this->assertTrue(class_exists('PersisterOneBehaviorBehavior'));
|
|
|
- $this->assertTrue(class_exists('TestPluginPersisterOneBehavior'));
|
|
|
- $this->assertTrue(class_exists('TestPluginComment'));
|
|
|
- $this->assertFalse(class_exists('PersisterTwoBehaviorBehavior'));
|
|
|
- $this->assertFalse(class_exists('TestPluginPersisterTwoBehavior'));
|
|
|
- $this->assertFalse(class_exists('TestPluginAuthors'));
|
|
|
-
|
|
|
- $Controller = new RequestActionPersistentController();
|
|
|
- $Controller->persistModel = true;
|
|
|
- $Controller->constructClasses();
|
|
|
-
|
|
|
- $this->assertTrue(class_exists('PersisterOneBehaviorBehavior'));
|
|
|
- $this->assertTrue(class_exists('PersisterTwoBehaviorBehavior'));
|
|
|
- $this->assertTrue(class_exists('TestPluginPersisterTwoBehavior'));
|
|
|
- $this->assertTrue(class_exists('TestPluginAuthors'));
|
|
|
-
|
|
|
- @unlink(CACHE . 'persistent' . DS . 'persisterone.php');
|
|
|
- @unlink(CACHE . 'persistent' . DS . 'persisteroneregistry.php');
|
|
|
- }
|
|
|
-
|
|
|
-/**
|
|
|
- * testPersistWithBehaviorAndRequestAction method
|
|
|
- *
|
|
|
- * @see testPersistWithBehavior
|
|
|
- * @access public
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function testPersistWithBehaviorAndRequestAction() {
|
|
|
- $this->markTestIncomplete('Object::persist() is totally broken right now.');
|
|
|
-
|
|
|
- ClassRegistry::flush();
|
|
|
-
|
|
|
- $cacheDisable = Configure::read('Cache.disable');
|
|
|
- Configure::write('Cache.disable', false);
|
|
|
-
|
|
|
- $this->assertFalse(class_exists('ContainableBehavior'));
|
|
|
-
|
|
|
- App::build(array(
|
|
|
- 'models' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS),
|
|
|
- 'behaviors' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model'. DS . 'Behavior' . DS),
|
|
|
- ), true);
|
|
|
-
|
|
|
- $this->assertFalse(class_exists('PersistOneBehaviorBehavior'));
|
|
|
- $this->assertFalse(class_exists('PersistTwoBehaviorBehavior'));
|
|
|
-
|
|
|
- $Controller = new RequestActionPersistentController();
|
|
|
- $Controller->persistModel = true;
|
|
|
- $Controller->constructClasses();
|
|
|
-
|
|
|
- $this->assertTrue(file_exists(CACHE . 'persistent' . DS . 'persisterone.php'));
|
|
|
- $this->assertTrue(file_exists(CACHE . 'persistent' . DS . 'persisteroneregistry.php'));
|
|
|
-
|
|
|
- $keys = ClassRegistry::keys();
|
|
|
- $this->assertEqual($keys, array(
|
|
|
- 'persister_one',
|
|
|
- 'comment',
|
|
|
- 'test_plugin_comment',
|
|
|
- 'test_plugin.test_plugin_comment',
|
|
|
- 'persister_one_behavior_behavior',
|
|
|
- 'test_plugin_persister_one_behavior',
|
|
|
- 'test_plugin.test_plugin_persister_one_behavior'
|
|
|
- ));
|
|
|
-
|
|
|
- ob_start();
|
|
|
- $Controller->set('content_for_layout', 'cool');
|
|
|
- $Controller->render('index', 'ajax', '/layouts/ajax');
|
|
|
- $result = ob_get_clean();
|
|
|
-
|
|
|
- $keys = ClassRegistry::keys();
|
|
|
- $this->assertEqual($keys, array(
|
|
|
- 'persister_one',
|
|
|
- 'comment',
|
|
|
- 'test_plugin_comment',
|
|
|
- 'test_plugin.test_plugin_comment',
|
|
|
- 'persister_one_behavior_behavior',
|
|
|
- 'test_plugin_persister_one_behavior',
|
|
|
- 'test_plugin.test_plugin_persister_one_behavior',
|
|
|
- 'view'
|
|
|
- ));
|
|
|
- $result = $this->object->requestAction('/request_action_persistent/index');
|
|
|
- $expected = 'This is a test';
|
|
|
- $this->assertEqual($expected, $result);
|
|
|
-
|
|
|
- @unlink(CACHE . 'persistent' . DS . 'persisterone.php');
|
|
|
- @unlink(CACHE . 'persistent' . DS . 'persisteroneregistry.php');
|
|
|
-
|
|
|
- $Controller = new RequestActionPersistentController();
|
|
|
- $Controller->persistModel = true;
|
|
|
- $Controller->constructClasses();
|
|
|
-
|
|
|
- @unlink(CACHE . 'persistent' . DS . 'persisterone.php');
|
|
|
- @unlink(CACHE . 'persistent' . DS . 'persisteroneregistry.php');
|
|
|
-
|
|
|
- Configure::write('Cache.disable', $cacheDisable);
|
|
|
- }
|
|
|
-
|
|
|
-/**
|
|
|
* testToString method
|
|
|
*
|
|
|
* @access public
|