test content toggleVisibility
This commit is contained in:
@@ -113,6 +113,8 @@ class Content extends BaseAction implements EventSubscriberInterface
|
|||||||
->setVisible(!$content->getVisible())
|
->setVisible(!$content->getVisible())
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
$event->setContent($content);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete(ContentDeleteEvent $event)
|
public function delete(ContentDeleteEvent $event)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace Thelia\Tests\Action;
|
|||||||
use Thelia\Action\Content;
|
use Thelia\Action\Content;
|
||||||
use Thelia\Core\Event\Content\ContentCreateEvent;
|
use Thelia\Core\Event\Content\ContentCreateEvent;
|
||||||
use Thelia\Core\Event\Content\ContentDeleteEvent;
|
use Thelia\Core\Event\Content\ContentDeleteEvent;
|
||||||
|
use Thelia\Core\Event\Content\ContentToggleVisibilityEvent;
|
||||||
use Thelia\Core\Event\Content\ContentUpdateEvent;
|
use Thelia\Core\Event\Content\ContentUpdateEvent;
|
||||||
use Thelia\Model\ContentQuery;
|
use Thelia\Model\ContentQuery;
|
||||||
use Thelia\Model\FolderQuery;
|
use Thelia\Model\FolderQuery;
|
||||||
@@ -107,6 +108,23 @@ class ContentTest extends BaseAction
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testContentToggleVisibility()
|
||||||
|
{
|
||||||
|
$content = $this->getRandomContent();
|
||||||
|
|
||||||
|
$visibility = $content->getVisible();
|
||||||
|
|
||||||
|
$event = new ContentToggleVisibilityEvent($content);
|
||||||
|
|
||||||
|
$contentAction = new Content($this->getContainer());
|
||||||
|
$contentAction->toggleVisibility($event);
|
||||||
|
|
||||||
|
$updatedContent = $event->getContent();
|
||||||
|
|
||||||
|
$this->assertInstanceOf('Thelia\Model\Content', $updatedContent);
|
||||||
|
$this->assertEquals(!$visibility, $updatedContent->getVisible());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Thelia\Model\Content
|
* @return \Thelia\Model\Content
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user