文件名称:轻量级的标记解析的PHP库.zip
文件大小:122KB
文件格式:ZIP
更新时间:2022-07-31 03:25:10
类库下载-轻量级的标记解析的PHP库
大家都知道,有很多方法可以进行标记解析,今天我们就带来利用轻量级的标记来解析的PHP库,一起来看一下。 <?php namespace Decoda; use Decoda\Decoda; use Decoda\Loader\FileLoader; use Decoda\Test\TestCase; use Decoda\Test\TestComponent; class ComponentTest extends TestCase { protected function setUp() { parent::setUp(); $this->object = new TestComponent(array('key' => 'value')); } public function testAddGetLoaders() { $this->assertEquals(0, count($this->object->getLoaders())); $this->object->addLoader(new FileLoader(TEST_DIR . '/config/test.php')); $this->assertEquals(1, count($this->object->getLoaders())); } public function testGetSetConfig() { $this->assertEquals('value', $this->object->getConfig('key')); $this->assertEquals(null, $this->object->getConfig('foobar')); $this->object->setConfig(array('key' => 'foo')); $this->assertEquals('foo', $this->object->getConfig('key')); } public function testGetSetParser() { $this->assertEquals(null, $this->object->getParser()); $this->object->setParser(new Decoda()); $this->assertInstanceOf('Decoda\Decoda', $this->object->getParser()); } public function testMessage() { $this->object->setParser(new Decoda()); $this->assertEquals('Quote by {author}', $this->object->message('quoteBy')); } }