/** * @expectedException WPDieException */ public function testIndexPostsDie() { $_REQUEST['paged'] = 1; $searchClient = m::mock('AliyunOpenSearchClient'); $searchClient->shouldReceive('savePosts')->once()->andThrow('AliyunOpenSearchException'); $this->admin->setOpenSearchClient($searchClient); $this->admin->indexPosts(); }