Пример #1
0
 /**
  * Tests category setter & getter if using SonataClassificationBundle
  */
 public function testCategoryGetters()
 {
     if (!interface_exists('Sonata\\ClassificationBundle\\Model\\CategoryInterface')) {
         $this->markTestSkipped('Sonata\\ClassificationBundle\\Model\\CategoryInterface does not exist');
     }
     // Given
     $category = $this->getMock('Sonata\\ClassificationBundle\\Model\\CategoryInterface');
     $category->expects($this->once())->method('getName')->will($this->returnValue('my-category'));
     $thread = new BaseThread();
     $thread->setId('my-comment-thread');
     $thread->setCategory($category);
     // Then
     $this->assertEquals('my-category', $thread->getCategory()->getName(), 'Should return correct category name');
 }