Beispiel #1
0
 /**
  * testNodeObjectFind method
  *
  * @return void
  */
 public function testNodeObjectFind()
 {
     $Aro = new DbAroTest();
     $Model = new DbAroUserTest();
     $Model->id = 1;
     $result = Set::extract($Aro->node($Model), '{n}.DbAroTest.id');
     $expected = array(3, 2, 1);
     $this->assertEquals($expected, $result);
     $Model->id = 2;
     $result = Set::extract($Aro->node($Model), '{n}.DbAroTest.id');
     $expected = array(4, 2, 1);
     $this->assertEquals($expected, $result);
 }
Beispiel #2
0
 /**
  * testNodeActionAuthorize method
  *
  * @return void
  */
 public function testNodeActionAuthorize()
 {
     App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), App::RESET);
     CakePlugin::load('TestPlugin');
     $Aro = new DbAroTest();
     $Aro->create();
     $Aro->save(array('model' => 'TestPluginAuthUser', 'foreign_key' => 1));
     $result = $Aro->id;
     $expected = 5;
     $this->assertEquals($expected, $result);
     $node = $Aro->node(array('TestPlugin.TestPluginAuthUser' => array('id' => 1, 'user' => 'mariano')));
     $result = Hash::get($node, '0.DbAroTest.id');
     $expected = $Aro->id;
     $this->assertEquals($expected, $result);
     CakePlugin::unload('TestPlugin');
 }