public function setPostTextAttribute($value) { $bbcode = new BBCodeForDB($value); $this->attributes['post_text'] = $bbcode->generate(); $this->attributes['bbcode_uid'] = $bbcode->uid; $this->attributes['bbcode_bitfield'] = $bbcode->bitfield; }
public function testAll() { $text = new BBCodeForDB(); $text->uid = $this->uid; $path = __DIR__ . '/bbcode_examples'; foreach (glob("{$path}/*.base.txt") as $baseFilePath) { $dbFilePath = preg_replace("/\\.base\\.txt\$/", '.db.txt', $baseFilePath); $text->text = trim(file_get_contents($baseFilePath)); $referenceDbOutput = trim(file_get_contents($dbFilePath)); $this->assertEquals($referenceDbOutput, $text->generate()); } }