コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function getUngroupedChoicesArray()
 {
     if ($this->getId() === tubepress_wordpress_api_Constants::OPTION_AUTOPOST_CATEGORIES) {
         $terms = $this->_resourceRepo->getAllCategories();
     } else {
         $terms = $this->_resourceRepo->getAllTags();
     }
     $toReturn = array();
     foreach ($terms as $term) {
         $toReturn[$term->slug] = $term->name;
     }
     return $toReturn;
 }
コード例 #2
0
 public function testCategories()
 {
     $term1 = new stdClass();
     $term2 = new stdClass();
     $fakeTerms = array($term2, $term1);
     $this->_mockWpFunctions->shouldReceive('get_categories')->once()->with(array('hide_empty' => false))->andReturn($fakeTerms);
     $actual = $this->_sut->getAllCategories();
     $this->assertSame($fakeTerms, $actual);
 }
コード例 #3
0
 public function onWpPostCategories(tubepress_api_event_EventInterface $event)
 {
     $terms = $this->_resourceRepository->getAllCategories();
     $this->_handleIncomingTerms($terms, $event, 'categories');
 }