server/src/tests/Controllers/ThemeControllerTest.php
author ymh <ymh.work@gmail.com>
Tue, 20 Mar 2018 15:02:40 +0100
changeset 573 25f3d28f51b2
parent 537 d2e6ee099125
permissions -rw-r--r--
Added tag 0.0.25 for changeset 190ae1dee68d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
use Mockery as m;
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
use EasyRdf\Resource;
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
use EasyRdf\Literal;
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
/**
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 *
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 */
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
class ThemeControllerTest extends TestCase {
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
    public function setUp() {
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
        parent::setup();
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
    public function tearDown() {
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
        m::close();
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
        parent::tearDown();
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    24
    public function testIndex() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    25
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    26
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    27
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    28
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    29
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    30
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
    31
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    32
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    33
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    34
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    35
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    36
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    37
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    38
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    39
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    40
                                    "size" => config('corpusparole.theme_default_limit'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    41
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    42
                                    "include" => ".*\|bnf\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    43
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
    44
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
    45
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
    46
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
    47
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
    48
                                ]
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    49
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    50
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    51
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    52
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    53
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    54
        ];
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    56
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    57
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    58
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    59
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    60
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    61
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    62
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    63
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    64
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    65
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    66
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    67
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    68
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    69
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    70
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    71
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    72
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    73
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    74
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    75
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    76
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    77
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    78
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    79
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    80
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    81
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    82
                                "key" => "travail non rémunéré|bnf|ark:/12148/cb16604691s",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    83
                                "doc_count" => 1092
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    84
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    85
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    86
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    87
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    88
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    89
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    90
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    91
                                "key" => "météorologie|bnf|ark:/12148/cb11932496x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    92
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    93
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    94
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    95
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    96
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    97
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    98
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
    99
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   100
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   101
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   102
                            ] ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   103
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   104
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   105
                            "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   106
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   107
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   108
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   109
            ]);
537
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   110
        $response = $this->get('/api/v1/stats/themes/');
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   111
        $response
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   112
            ->assertStatus(200)
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   113
            ->assertJson(["themes" => [
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   114
            "http://ark.bnf.fr/ark:/12148/cb13318415c" => ['label' => 'professions', 'count' => 1412 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   115
            "http://ark.bnf.fr/ark:/12148/cb16604691s" => ['label' => 'travail non rémunéré', 'count' => 1092 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   116
            "http://ark.bnf.fr/ark:/12148/cb119339867" => ['label' => 'famille', 'count' => 1050 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   117
            "http://ark.bnf.fr/ark:/12148/cb11932889r" => ['label' => 'oiseaux', 'count' => 1003 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   118
            "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   119
            "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995  ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   120
            "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   121
            "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   122
        ], "meta" => ['total' => 999]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   126
    public function testIndexAll() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   127
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   128
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   129
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   130
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   131
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   132
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
   133
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   134
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   135
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   136
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   137
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   138
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   139
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   140
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   141
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   142
                                    "size" => config('corpusparole.theme_default_limit'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   143
                                    "order" => [ '_count' => 'desc' ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   144
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   145
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   146
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   147
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   148
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   149
                                ]
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   150
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   151
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   152
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   153
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   154
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   155
        ];
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   157
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   158
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   159
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   160
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   161
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   162
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   163
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   164
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   165
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   166
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   167
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   168
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   169
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   170
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   171
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   172
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   173
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   174
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   175
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   176
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   177
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   178
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   179
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   180
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   181
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   182
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   183
                                "key" => "travail non rémunéré|bnf|ark:/12148/cb16604691s",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   184
                                "doc_count" => 1092
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   185
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   186
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   187
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   188
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   189
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   190
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   191
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   192
                                "key" => "Français|lxv|fra",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   193
                                "doc_count" => 1002
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   194
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   195
                                "key" => "météorologie|bnf|ark:/12148/cb11932496x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   196
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   197
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   198
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   199
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   200
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   201
                                "key" => "Breton|lxv|bzh",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   202
                                "doc_count" => 992
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   203
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   204
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   205
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   206
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   207
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   208
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   209
                            ] ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   210
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   211
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   212
                            "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   213
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   214
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   215
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   216
            ]);
537
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   217
        $response = $this->get('/api/v1/stats/themes/?filter=all');
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   218
        $response
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   219
            ->assertStatus(200)
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   220
            ->assertJson(["themes" => [
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   221
            "http://ark.bnf.fr/ark:/12148/cb13318415c" => ['label' => 'professions', 'count' => 1412 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   222
            "http://ark.bnf.fr/ark:/12148/cb16604691s" => ['label' => 'travail non rémunéré', 'count' => 1092 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   223
            "http://ark.bnf.fr/ark:/12148/cb119339867" => ['label' => 'famille', 'count' => 1050 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   224
            "http://ark.bnf.fr/ark:/12148/cb11932889r" => ['label' => 'oiseaux', 'count' => 1003 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   225
            "http://lexvo.org/id/iso639-3/fra" => ['label' => 'Français', 'count' => 1002 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   226
            "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   227
            "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995  ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   228
            "http://lexvo.org/id/iso639-3/bzh" => ['label' => 'Breton', 'count' => 992 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   229
            "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   230
            "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   231
        ], "meta" => ['total' => 999]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   235
    public function testIndexLexvo() {
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   236
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   237
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   238
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   239
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   240
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   241
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
   242
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   243
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   244
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   245
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   246
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   247
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   248
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   249
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   250
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   251
                                    "size" => config('corpusparole.theme_default_limit'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   252
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   253
                                    "include" => ".*\|lxv\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   254
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   255
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   256
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   257
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   258
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   259
                                ]
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   260
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   261
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   262
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   263
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   264
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   265
        ];
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   266
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   267
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   268
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   269
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   270
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   271
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   272
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   273
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   274
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   275
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   276
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   277
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   278
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   279
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   280
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   281
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   282
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   283
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   284
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   285
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   286
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   287
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   288
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   289
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   290
                                "key" => "Français|lxv|fra",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   291
                                "doc_count" => 1002
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   292
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   293
                                "key" => "Breton|lxv|bzh",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   294
                                "doc_count" => 992
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   295
                            ] ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   296
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   297
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   298
                            "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   299
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   300
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   301
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   302
            ]);
537
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   303
        $response = $this->get('/api/v1/stats/themes/?filter=lexvo');
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   304
        $response
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   305
            ->assertStatus(200)
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   306
            ->assertJson(["themes" => [
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   307
            "http://lexvo.org/id/iso639-3/fra" => ['label' => 'Français', 'count' => 1002 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   308
            "http://lexvo.org/id/iso639-3/bzh" => ['label' => 'Breton', 'count' => 992 ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   309
        ], "meta" => ['total' => 999]]);
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   310
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   311
    }
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   312
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   313
    private function getOrderQuery($order) {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   314
        return [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   315
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   316
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   317
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   318
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
   319
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   320
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   321
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   322
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   323
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   324
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   325
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   326
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   327
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   328
                                    "size" => config('corpusparole.theme_default_limit'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   329
                                    "order" => $order,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   330
                                    "include" => ".*\|bnf\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   331
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   332
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   333
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   334
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   335
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   336
                                ]
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   337
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   338
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   339
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   340
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   341
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   342
        ];
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   343
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   344
    }
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   345
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   346
    private function getRespSort() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   347
        return [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   348
            "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   349
            "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   350
            "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   351
                "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   352
                "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   353
                "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   354
            ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   355
            "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   356
                "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   357
                "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   358
                "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   359
            ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   360
            "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   361
                "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   362
                    "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   363
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   364
                        "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   365
                        "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   366
                        "buckets" => [  ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   367
                    ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   368
                    "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   369
                        "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   370
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   371
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   372
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   373
        ];
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   374
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   375
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   376
    public function testIndexSort() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   377
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   378
        Es::shouldReceive('search')
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   379
            ->once()
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   380
            ->with($this->getOrderQuery(['_count' => 'desc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   381
            ->andReturn($this->getRespSort());
537
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   382
        $this->get('/api/v1/stats/themes/')->assertStatus(200);
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   383
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   384
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   385
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   386
    public function testIndexSortReverseCount() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   387
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   388
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   389
            ->with($this->getOrderQuery(['_count' => 'asc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   390
            ->andReturn($this->getRespSort());
537
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   391
        $this->get('/api/v1/stats/themes/?sort=-count')->assertStatus(200);
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   392
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   393
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   394
    public function testIndexSortLabel() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   395
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   396
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   397
            ->with($this->getOrderQuery(['_term' => 'asc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   398
            ->andReturn($this->getRespSort());
537
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   399
        $this->get('/api/v1/stats/themes/?sort=label')->assertStatus(200);
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   400
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   401
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   402
    public function testIndexSortAlphabetical() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   403
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   404
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   405
            ->with($this->getOrderQuery(['_term' => 'asc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   406
            ->andReturn($this->getRespSort());
537
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   407
        $this->get('/api/v1/stats/themes/?sort=alphabetical')->assertStatus(200);
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   408
    }
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   409
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   410
    public function testIndexSortLabelReverse() {
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   411
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   412
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   413
            ->with($this->getOrderQuery(['_term' => 'desc']))
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   414
            ->andReturn($this->getRespSort());
537
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   415
        $this->get('/api/v1/stats/themes/?sort=-label')->assertStatus(200);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   416
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   417
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   418
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   419
    public function testIndexLimit() {
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   420
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   421
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   422
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   423
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   424
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   425
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
   426
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   427
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   428
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   429
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   430
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   431
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   432
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   433
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   434
                                    "field" => "subject.label_code",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   435
                                    "size" => 3,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   436
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   437
                                    "include" => ".*\|bnf\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   438
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   439
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   440
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   441
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   442
                                    "field" => "subject.label_code"
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   443
                                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   444
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   445
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   446
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   447
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   448
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   449
        ];
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   450
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   451
        // This is not normally what should be received, but we test that the limit is respected
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   452
        Es::shouldReceive('search')
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   453
            ->once()
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   454
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   455
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   456
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   457
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   458
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   459
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   460
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   461
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   462
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   463
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   464
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   465
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   466
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   467
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   468
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   469
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   470
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   471
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   472
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   473
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   474
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   475
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   476
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   477
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   478
                                "key" => "travail non rémunéré|bnf|ark:/12148/cb16604691s",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   479
                                "doc_count" => 1092
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   480
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   481
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   482
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   483
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   484
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   485
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   486
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   487
                                "key" => "météorologie|bnf|ark:/12148/cb11932496x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   488
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   489
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   490
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   491
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   492
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   493
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   494
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   495
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   496
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   497
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   498
                            ] ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   499
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   500
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   501
                            "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   502
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   503
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   504
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   505
            ]);
537
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   506
        $response = $this->get('/api/v1/stats/themes/?limit=3')->assertStatus(200);
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   507
        $response->assertJson(["themes" => [
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   508
            "http://ark.bnf.fr/ark:/12148/cb13318415c" => ['label' => 'professions', 'count' => 1412 ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   509
            "http://ark.bnf.fr/ark:/12148/cb16604691s" => ['label' => 'travail non rémunéré', 'count' => 1092 ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   510
            "http://ark.bnf.fr/ark:/12148/cb119339867" => ['label' => 'famille', 'count' => 1050 ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   511
        ], "meta" => ['total' => 999]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   512
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   513
    }
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   514
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   515
    public function testIndexIndex() {
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   516
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   517
        $query = [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   518
            'index' => env('ELASTICSEARCH_INDEX'),
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   519
            'body' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   520
                'size' => 0,
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   521
                'query' =>[
407
2dba812c7ef2 add a way to build rpm for puppet files, correct elasticsearch provisioning, correct error on elasticsearch queries + tests
ymh <ymh.work@gmail.com>
parents: 387
diff changeset
   522
                    'match_all' => (object) null
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
   523
                ],
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   524
                'aggs' => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   525
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   526
                        "nested" => [ "path" => "subject" ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   527
                        "aggs" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   528
                            "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   529
                                "terms" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   530
                                    "field" => "subject.label_code",
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   531
                                    "size" => 6,
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   532
                                    "order" => [ '_count' => 'desc' ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   533
                                    "include" => ".*\|bnf\|.*"
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   534
                                ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   535
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   536
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   537
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   538
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   539
                                ]
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   540
                            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   541
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   542
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   543
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   544
            ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   545
        ];
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   546
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   547
        // This is not normally what should be received, but we test that the limit is respected
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   548
        Es::shouldReceive('search')
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   549
            ->once()
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   550
            ->with($query)
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   551
            ->andReturn([
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   552
                "took" => 27,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   553
                "timed_out" => false,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   554
                "_shards" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   555
                    "total" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   556
                    "successful" => 1,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   557
                    "failed" => 0
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   558
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   559
                "hits" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   560
                    "total" => 3011,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   561
                    "max_score" => 0.0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   562
                    "hits" => [ ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   563
                ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   564
                "aggregations" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   565
                    "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   566
                        "doc_count" => 41524,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   567
                        "subjects" => [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   568
                            "doc_count_error_upper_bound" => 0,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   569
                            "sum_other_doc_count" => 13678,
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   570
                            "buckets" => [ [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   571
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   572
                                "doc_count" => 1412
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   573
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   574
                                "key" => "travail non rémunéré|bnf|ark:/12148/cb16604691s",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   575
                                "doc_count" => 1092
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   576
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   577
                                "key" => "famille|bnf|ark:/12148/cb119339867",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   578
                                "doc_count" => 1050
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   579
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   580
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   581
                                "doc_count" => 1003
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   582
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   583
                                "key" => "météorologie|bnf|ark:/12148/cb11932496x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   584
                                "doc_count" => 1001
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   585
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   586
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   587
                                "doc_count" => 995
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   588
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   589
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   590
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   591
                            ], [
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   592
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   593
                                "doc_count" => 989
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   594
                            ] ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   595
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   596
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   597
                            "value" => 999
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   598
                        ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   599
                    ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   600
                ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   601
            ]);
537
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   602
        $response = $this->get('/api/v1/stats/themes/?limit=3&index=1')->assertStatus(200);
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   603
        $response->assertJson(["themes" => [
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   604
            "http://ark.bnf.fr/ark:/12148/cb11932889r" => ['label' => 'oiseaux', 'count' => 1003 ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   605
            "http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   606
            "http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995  ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   607
        ], "meta" => ['total' => 999]]);
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   608
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   609
    }
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   610
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   611
    public function testIndexLimitIndex2() {
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   612
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   613
        $query = [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   614
            'index' => env('ELASTICSEARCH_INDEX'),
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   615
            'body' => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   616
                'size' => 0,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   617
                'query' =>[
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   618
                    'match_all' => (object) null
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   619
                ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   620
                'aggs' => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   621
                    "subjects" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   622
                        "nested" => [ "path" => "subject" ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   623
                        "aggs" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   624
                            "subjects" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   625
                                "terms" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   626
                                    "field" => "subject.label_code",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   627
                                    "size" => 9,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   628
                                    "order" => [ '_count' => 'desc' ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   629
                                    "include" => ".*\|bnf\|.*"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   630
                                ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   631
                            ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   632
                            "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   633
                                "cardinality" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   634
                                    "field" => "subject.label_code"
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   635
                                ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   636
                            ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   637
                        ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   638
                    ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   639
                ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   640
            ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   641
        ];
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   642
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   643
        // This is not normally what should be received, but we test that the limit is respected
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   644
        Es::shouldReceive('search')
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   645
            ->once()
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   646
            ->with($query)
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   647
            ->andReturn([
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   648
                "took" => 27,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   649
                "timed_out" => false,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   650
                "_shards" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   651
                    "total" => 1,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   652
                    "successful" => 1,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   653
                    "failed" => 0
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   654
                ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   655
                "hits" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   656
                    "total" => 3011,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   657
                    "max_score" => 0.0,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   658
                    "hits" => [ ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   659
                ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   660
                "aggregations" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   661
                    "subjects" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   662
                        "doc_count" => 41524,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   663
                        "subjects" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   664
                            "doc_count_error_upper_bound" => 0,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   665
                            "sum_other_doc_count" => 13678,
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   666
                            "buckets" => [ [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   667
                                "key" => "professions|bnf|ark:/12148/cb13318415c",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   668
                                "doc_count" => 1412
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   669
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   670
                                "key" => "travail non rémunéré|bnf|ark:/12148/cb16604691s",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   671
                                "doc_count" => 1092
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   672
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   673
                                "key" => "famille|bnf|ark:/12148/cb119339867",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   674
                                "doc_count" => 1050
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   675
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   676
                                "key" => "oiseaux|bnf|ark:/12148/cb11932889r",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   677
                                "doc_count" => 1003
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   678
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   679
                                "key" => "météorologie|bnf|ark:/12148/cb11932496x",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   680
                                "doc_count" => 1001
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   681
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   682
                                "key" => "plantes|bnf|ark:/12148/cb11933145f",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   683
                                "doc_count" => 995
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   684
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   685
                                "key" => "animaux sauvages|bnf|ark:/12148/cb11930908q",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   686
                                "doc_count" => 989
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   687
                            ], [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   688
                                "key" => "arbres|bnf|ark:/12148/cb11934786x",
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   689
                                "doc_count" => 989
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   690
                            ] ]
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   691
                        ],
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   692
                        "subjects_count" => [
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   693
                            "value" => 999
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   694
                        ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   695
                    ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   696
                ]
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   697
            ]);
537
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   698
        $response = $this->get('/api/v1/stats/themes/?limit=3&index=2')->assertStatus(200);
d2e6ee099125 upgrade ember + laravel + make everything work
ymh <ymh.work@gmail.com>
parents: 474
diff changeset
   699
        $response->assertJson(["themes" => [
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   700
            "http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ],
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   701
            "http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ]
474
245b4df137d3 Correct themes visualisation
ymh <ymh.work@gmail.com>
parents: 407
diff changeset
   702
        ], "meta" => ['total' => 999]]);
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   703
    }
322
084aae09edf4 correction on importRDF documents + evolution theme controller
ymh <ymh.work@gmail.com>
parents: 306
diff changeset
   704
158
366509ae2f37 Add controller for themes count + upgrade ember for app-client
ymh <ymh.work@gmail.com>
parents:
diff changeset
   705
}