/** * Tests that altering data in a beforeValidate callback will lead to saving those * values in database, this time with belongsTo associations * * @return void */ public function testValidateFirstAssociatedWithBeforeValidate2() { $this->loadFixtures('Boat', 'User'); $model = new CustomBoat(); $model->validate = array('title' => array('notBlank' => array('rule' => 'notBlank', 'required' => true))); $data = array('User' => array('user' => 'foo', 'password' => 'bar'), 'CustomBoat' => array('body' => 'a test')); $result = $model->saveAll($data, array('validate' => 'first')); $this->assertTrue($result); $this->assertEquals('foo', $model->field('title', array('body' => 'a test'))); }