JamesMoss\Flywheel\RespositoryTest::testStoringDocuments PHP Method

testStoringDocuments() public method

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