40 $this->sparqlClient |
40 $this->sparqlClient |
41 ->shouldReceive('query') |
41 ->shouldReceive('query') |
42 ->with($query) |
42 ->with($query) |
43 ->once() |
43 ->once() |
44 ->andReturn(new \ArrayIterator([])); |
44 ->andReturn(new \ArrayIterator([])); |
45 $this->get('/api/v1/themes/'); |
45 $this->get('/api/v1/stats/themes/'); |
46 } |
46 } |
47 |
47 |
48 public function testIndexQueryBnf() { |
48 public function testIndexQueryBnf() { |
49 |
49 |
50 $query = preg_replace('/\s+/', ' ', "select (?o as ?theme) (COUNT(?s) as ?count) where { |
50 $query = preg_replace('/\s+/', ' ', "select (?o as ?theme) (COUNT(?s) as ?count) where { |
112 $this->sparqlClient |
112 $this->sparqlClient |
113 ->shouldReceive('query') |
113 ->shouldReceive('query') |
114 ->with($query) |
114 ->with($query) |
115 ->once() |
115 ->once() |
116 ->andReturn(new \ArrayIterator([])); |
116 ->andReturn(new \ArrayIterator([])); |
117 $this->get('/api/v1/themes/?filter='); |
117 $this->get('/api/v1/stats/themes/?filter='); |
118 } |
118 } |
119 |
119 |
120 public function testIndexQueryUri() { |
120 public function testIndexQueryUri() { |
121 |
121 |
122 $query = preg_replace('/\s+/', ' ', "select (?o as ?theme) (COUNT(?s) as ?count) where { |
122 $query = preg_replace('/\s+/', ' ', "select (?o as ?theme) (COUNT(?s) as ?count) where { |
144 ->andReturn(new \ArrayIterator([ |
144 ->andReturn(new \ArrayIterator([ |
145 (object)['theme'=>new Resource('http://lexvo.org/id/iso639-3/gsw'), 'count' => Literal::create(44)], |
145 (object)['theme'=>new Resource('http://lexvo.org/id/iso639-3/gsw'), 'count' => Literal::create(44)], |
146 (object)['theme'=>new Resource('http://ark.bnf.fr/ark:/12148/cb119339867'), 'count' => Literal::create(33)], |
146 (object)['theme'=>new Resource('http://ark.bnf.fr/ark:/12148/cb119339867'), 'count' => Literal::create(33)], |
147 (object)['theme'=>Literal::create('Français', 'fr'), 'count' => Literal::create(22)], |
147 (object)['theme'=>Literal::create('Français', 'fr'), 'count' => Literal::create(22)], |
148 ])); |
148 ])); |
149 $this->get('/api/v1/themes/')->assertTrue($this->response->isOk(), $this->response->content()); |
149 $this->get('/api/v1/stats/themes/')->assertTrue($this->response->isOk(), $this->response->content()); |
150 $this->seeJsonEquals(["themes" => [ |
150 $this->seeJsonEquals(["themes" => [ |
151 "http://lexvo.org/id/iso639-3/gsw" => ["label" => "alémanique", "count" => 44], |
151 "http://lexvo.org/id/iso639-3/gsw" => ["label" => "alémanique", "count" => 44], |
152 "http://ark.bnf.fr/ark:/12148/cb119339867" => ["label" => "famille", "count" => 33], |
152 "http://ark.bnf.fr/ark:/12148/cb119339867" => ["label" => "famille", "count" => 33], |
153 "Français" => ["label" => "Français", "count" => 22], |
153 "Français" => ["label" => "Français", "count" => 22], |
154 ]]); |
154 ]]); |