Fixtures::load_fixtures PHP Method

load_fixtures() public method

public load_fixtures ( )
    function load_fixtures()
    {
        //Insert  City
        $this->client->post('/document/' . $this->dbname, $this->contentType, '{"@class": "City", "name": "Rome" }')->send();
        //Insert  Address
        for ($i = 0; $i < 40; $i++) {
            $this->client->post('/document/' . $this->dbname, $this->contentType, sprintf('{"@class": "Address", "street" : "New street %d, Italy", "city":"#' . $this->City . ':0"}', $i))->send();
        }
        //Insert countries
        $countries = array('France', 'Italy', 'Spain', 'England', 'Ireland', 'Poland', 'Bulgaria', 'Portogallo', 'Belgium', 'Suisse');
        foreach ($countries as $country) {
            $this->client->post('/document/' . $this->dbname, $this->contentType, '{"@class": "Country", "name": "' . $country . '" }')->send();
        }
        //Insert Profile
        $profiles = array('David', 'Alex', 'Luke', 'Marko', 'Rexter', 'Gremlin', 'Thinkerpop', 'Frames');
        foreach ($profiles as $profile) {
            $this->client->post('/document/' . $this->dbname, $this->contentType, '{"@class": "Profile", "name": "' . $profile . '" }')->send();
        }
        //Insert Comment
        $templateComment = '{"@class": "Comment", "body": "comment number %d" }';
        for ($i = 0; $i <= 5; $i++) {
            $this->client->post('/document/' . $this->dbname, $this->contentType, sprintf($templateComment, $i, $i))->send();
        }
        //Insert Post
        $templatePost = '{"@class": "Post", "id":"%d","title": "%d", "body": "Body %d", "comments":["#' . $this->Comment . ':3"] }';
        for ($i = 0; $i <= 5; $i++) {
            $this->client->post('/document/' . $this->dbname, $this->contentType, sprintf($templatePost, $i, $i, $i))->send();
        }
        $this->client->post('/document/' . $this->dbname, $this->contentType, '{"@class": "Post", "id":"6","title": "titolo 6", "body": "Body 6", "comments":["#' . $this->Comment . ':2"] }')->send();
        //Insert MapPoint
        $this->client->post('/document/' . $this->dbname, $this->contentType, '{"@class": "MapPoint", "x": "42.573968", "y": "13.203125" }')->send();
        return $this;
    }