Neos\Media\Tests\Functional\Domain\Model\AssetTest::setTags PHP Method

setTags() public method

public setTags ( )
    public function setTags()
    {
        $tagLabels = ['foo', 'bar'];
        $tagCollection = new ArrayCollection();
        foreach ($tagLabels as $tagLabel) {
            $tag = new Tag($tagLabel);
            $this->tagRepository->add($tag);
            $tagCollection->add($tag);
        }
        $asset = $this->buildAssetObject();
        $asset->setTags($tagCollection);
        $this->persistenceManager->persistAll();
        $this->persistenceManager->clearState();
        $asset = $this->assetRepository->findAll()->getFirst();
        $this->assertAssetHasTags($asset, $tagLabels);
    }