-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example on how to run testcases on models that actAs MeioUpload #44
Comments
You will need to define what your Product->createProductDetails() method does, or we cannot help you. |
createProductDetails is just a wrapper for saveAll($data, array('validate'=>'first')); |
then why are you not just calling that instead? |
Your ProductImage model are using MeioUpload as behavior? You are using master or 3.0 version? |
i am using master |
okie i have changed this code to using saveAll. Please let me know if there is any error in the way i test my models. Thank you. |
By security questions, the code test if the file is uploaded (using is_uploaded_file ). You can't test using simple test case, you need create a web test case. In 3.0 branch you can see some exemples. |
Hi,
i have a Product that hasMany ProductImage which actsAs MeioUpload.
i run the below test case, but apprently i cannot create the image record in my database.
please advise how to overcome this situation.
code also found in http://bin.cakephp.org/saved/58605
$data = array();
$data['Product']['title'] = 'ally';
$data['Product']['description'] = 'ally';
$data['Product']['shop_id'] = '1';
$data['Product']['status'] = true;
$data['Product']['price'] = 1001;
$data['Product']['code'] = '0001';
$data['ProductImage']['0']['filename'] = array(
'name' => 'test_product_model.jpg',
'type' => 'image/jpeg',
'tmp_name' => realpath(WWW_ROOT.DS.'img'.DS.'test_product_model.jpg'),
'error' => 0,
'size' => 107266,
);
The text was updated successfully, but these errors were encountered: