예제 #1
0
파일: boot.php 프로젝트: rickard2/utcw
 function get_data_object(array $instance, array $query_terms)
 {
     $plugin = $this->mockFactory->getUTCWMock();
     $db = $this->mockFactory->getWPDBMock();
     $db->expects($this->testCase->any())->method('get_results')->will($this->testCase->returnValue($query_terms));
     $plugin->set('wpdb', $db);
     $plugin->set('dataConfig', $this->get_data_config($instance, $plugin));
     return new UTCW_Data($plugin);
 }
예제 #2
0
 function helper_query_contains($instance, $string, $authenticated = false)
 {
     $utcw = $authenticated ? $this->mockFactory->getUTCWAuthenticated() : $this->mockFactory->getUTCWNotAuthenticated();
     $utcw->expects($this->any())->method('checkTermTaxonomy')->will($this->returnValue(true))->with($this->anything(), $this->contains('post_tag'));
     $config = new UTCW_DataConfig($instance, $utcw);
     $db = $this->mockFactory->getWPDBMock();
     $db->expects($this->once())->method('get_results')->will($this->returnValue(array()))->with($this->stringContains($string));
     $utcw->set('wpdb', $db);
     $utcw->set('dataConfig', $config);
     $data = new UTCW_Data($utcw);
     $data->getTerms();
 }
예제 #3
0
 function setUp()
 {
     $this->mockFactory = new MockFactory($this);
     $this->wpdb = $this->mockFactory->getWPDBMock();
     $this->term = $this->get_term();
 }