/** * @dataProvider dataResumeSave_Error * @expectedException ResumeSaveErrorException */ public function testResumeSave_Error($id, $json) { $db_stub = $this->getMockBuilder('wpdb')->disableOriginalConstructor()->setMethods(array('insert'))->getMock(); $db_stub->method('insert')->willReturn(false); $resume = new HeadHunterResume($db_stub, null, null); $resume->save($id, $json); }
<?php require_once WP_PLUGIN_DIR . '/' . dirname(plugin_basename(__FILE__)) . '/bootstrap.php'; require_once WP_PLUGIN_DIR . '/' . dirname(plugin_basename(__FILE__)) . '/Resume.php'; $this_page_url = 'admin.php?page=headhunter_resume/headhunter_resume_import_settings.php'; $resume = new HeadHunterResume($wpdb, $plugin_dir, $downloader); //try { if (isset($_POST['hh_resume_id_download'])) { $id = trim($_POST['hh_resume_id_download']); $res = $resume->download($id); $resume->save($id, $res); } elseif (isset($_POST['hh_resume_id_update'])) { $res = $resume->update(trim($_POST['hh_resume_id_update'])); } elseif (isset($_POST['hh_resume_id_delete'])) { $res = $resume->delete(trim($_POST['hh_resume_id_delete'])); } /*} catch(Exception $e) { echo $e->getTraceAsString(); exit; }*/ $res = $resume->get(); //var_dump($res); ?> <div class="wrap"> <h2><?php echo _e('Import CV from hh.ru', 'hh-resume'); ?> </h2> <?php if (!$res) {
/** * @dataProvider dataDownloadResume_IdIsntCalidError * @expectedException IdIsntValidException */ public function testDownload_IdIsntValidError($id) { $resume = new HeadHunterResume(null, null, null); $resume->download($id); }