예제 #1
0
파일: Post.php 프로젝트: ppy/osu-web
 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;
 }
예제 #2
0
 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());
     }
 }