public function test_restful_can_be_any_argument()
 {
     $this->generate->controller(array('admin', 'restful', 'index:post'));
     $contents = file::get(self::$controller);
     $this->assertContains('public $restful = true', $contents);
     $this->assertContains('post_index', $contents);
 }
 public function test_controllers_can_be_restful()
 {
     $this->generate->controller(array('admin', 'index', 'index:post', 'update:put', 'restful'));
     $contents = file::get(self::$controller);
     $this->assertContains('public $restful = true', $contents);
     $this->assertContains('get_index', $contents);
     $this->assertContains('post_index', $contents);
     $this->assertContains('put_update', $contents);
 }
Пример #3
0
 /**
  * Adding new files from Request in begin of uploading
  *
  * @param file $files   
  */
 public function addNewFromFiles($files)
 {
     $file = $files->get('file');
     $fileFullName = $file->getClientOriginalName();
     $this->status = self::STATUS_NEW;
     $this->fullname = $fileFullName;
     $fileParts = explode(".", $fileFullName);
     $this->ext = end($fileParts);
     $this->name = str_replace('.' . $this->ext, '', $fileFullName);
     $this->created = time();
     $this->mime = $file->getMimeType();
     $this->size = $file->getSize();
     $this->save();
     return $this;
 }