JamesMoss\Flywheel\NestedRespositoryTest::testStoringDocuments PHP 메소드

testStoringDocuments() 공개 메소드

    public function testStoringDocuments()
    {
        exec('rm -rf /tmp/flywheel/_pages');
        if (!is_dir('/tmp/flywheel')) {
            mkdir('/tmp/flywheel');
        }
        $config = new Config('/tmp/flywheel');
        $repo = new NestedRepository('_pages', $config);
        for ($i = 0; $i < 5; $i++) {
            $data = array('slug' => '123', 'body' => 'THIS IS BODY TEXT');
            $document = new Document($data);
            $document->setId($i . '/test/' . $i);
            $repo->store($document);
            $name = $i . '.json';
            $this->assertSame($data, (array) json_decode(file_get_contents('/tmp/flywheel/_pages/' . $i . '/test/' . $name)));
        }
    }