public function testToggleVisibility() { $category = $this->getRandomCategory(); $expectedVisibility = !$category->getVisible(); $event = new CategoryToggleVisibilityEvent($category); $event->setDispatcher($this->getDispatcher()); $action = new Category(); $action->toggleVisibility($event); $updatedCategory = $event->getCategory(); $this->assertInstanceOf('Thelia\\Model\\Category', $updatedCategory); $this->assertEquals($expectedVisibility, $updatedCategory->getVisible()); }