public function testSingleWithSubFolders2() { // setup $this->Model->Behaviors->load('Media.Attachable', array()); $this->Model->configureAttachment(array('file' => array('baseDir' => $this->attachmentDir, 'multiple' => false, 'removeOnOverwrite' => true, 'subFolder' => '{MODEL}{DS}{MODELID}{DS}')), true); // save $data = array($this->Model->alias => array('title' => 'My Upload with subfolders2', 'file_upload' => $this->upload1)); $this->Model->create(); $result = $this->Model->save($data); $this->assertTrue(is_array($result)); $this->assertTrue(isset($result['Attachment']['file']['path'])); $File = new File($result['Attachment']['file']['path'], false); $this->assertTrue($File->exists()); $this->assertTrue($File->folder()->inPath($this->attachmentDir . 'attachable_model' . DS)); }