Example #1
0
 function test_tags_list_taxonomy()
 {
     $utcw = $this->mockFactory->getUTCWMock();
     $utcw->expects($this->any())->method('checkTermTaxonomy')->will($this->returnValue(false));
     $instance = array('tags_list_type' => 'include', 'tags_list' => array(1, 2, 3, 4, 5));
     $db = $this->mockFactory->getWPDBMock();
     $db->expects($this->once())->method('get_results')->will($this->returnValue(array()))->with(new PHPUnit_Framework_Constraint_Not($this->stringContains('t.term_id IN (')));
     $utcw->set('wpdb', $db);
     $utcw->set('dataConfig', new UTCW_DataConfig($instance, $utcw));
     $data = new UTCW_Data($utcw);
     $data->getTerms();
 }
Example #2
0
 public function test_lets_translation_handler_create_term_when_enabled()
 {
     $plugin = $this->mockFactory->getUTCWMock();
     $handler = $this->getMockForAbstractClass('UTCW_TranslationHandler');
     $this->wpdb->expects($this->once())->method('get_results')->will($this->returnValue(array($this->term)));
     $handler->expects($this->once())->method('createTerm')->with($this->get_term(), $plugin);
     $plugin->set('translationHandler', $handler);
     $plugin->set('wpdb', $this->wpdb);
     $config = new UTCW_DataConfig(array(), $plugin);
     $plugin->set('dataConfig', $config);
     $data = new UTCW_Data($plugin);
     $data->getTerms();
 }
Example #3
0
 function helper_int_fail($option, $fail_int = 'fail')
 {
     $input = new stdClass();
     $input->{$option} = $fail_int;
     $tag = new UTCW_Term($input, $this->mockFactory->getUTCWMock());
     $this->assertNull($tag->{$option});
 }
Example #4
0
 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);
 }
Example #5
0
 function test_applies_filters()
 {
     $utcw = $this->mockFactory->getUTCWMock(array('applyFilters'));
     $dp = new DataProvider($this);
     $terms = $dp->termsProvider(1);
     $term = $terms[0][0][0];
     $utcw->expects($this->exactly(7))->method('applyFilters')->with($this->logicalOr($this->equalTo('widget_title'), $this->equalTo('utcw_render_css'), $this->equalTo('utcw_render_terms'), $this->equalTo('utcw_render_term_title_singular'), $this->equalTo('utcw_render_term_title_plural'), $this->equalTo('utcw_render_tag'), $this->equalTo('utcw_render_term_display_name')))->will($this->returnCallback(create_function('$filter, $value', 'return $filter === "utcw_render_terms" ? $value : "";')));
     $renderer = $this->getRenderer(array(), array($term), $utcw);
     $renderer->getCloud();
 }