public function testSetStringValue()
 {
     /** @var Post $post */
     $post = Post::findOne(2);
     $post->attachBehavior('target-tags', ['class' => Target::className(), 'targetAttribute' => 'tagNames', 'delimiter' => false]);
     $this->assertEquals(['tag 2', 'tag 3', 'tag 4'], $post->tagNames);
     $post->tagNames = 'test';
     $this->assertEquals(['test'], $post->tagNames);
     $post->tagNames = 'test, test2, test3';
     $this->assertEquals(['test, test2, test3'], $post->tagNames);
 }
 public function testValidatePost()
 {
     /** @var Post $post */
     $post = Post::findOne(2);
     $post->attachBehavior('target-tags', ['class' => Target::className(), 'targetAttribute' => 'tagNames', 'beforeLink' => function ($tag) {
         /** @var Tag $tag */
         $tag->frequency = 'aaa';
     }]);
     $post->tagNames = ['tag 3', 'tag 6', 'mega long tag name'];
     $this->assertEquals(false, $post->save());
     $this->assertEquals(['tagNames' => ['[tag 6] Frequency must be an integer.', '[mega long tag name] Name should contain at most 6 characters.', '[mega long tag name] Frequency must be an integer.']], $post->getErrors());
 }