fix service lookup in lower-case

This commit is contained in:
Benoît Burnichon
2016-03-30 17:42:46 +02:00
parent 07993efb58
commit c8063fa136
3 changed files with 4 additions and 4 deletions

View File

@@ -129,7 +129,7 @@ class FieldsController extends Controller
{
$vocabularies = $this->getVocabularies();
$vocabulary = $vocabularies[$type];
$vocabulary = $vocabularies[strtolower($type)];
Assertion::isInstanceOf($vocabulary, ControlProviderInterface::class);

View File

@@ -28,7 +28,7 @@ class Fields implements ControllerProviderInterface, ServiceProviderInterface
$app['vocabularies'] = $app->share(function (PhraseaApplication $app) {
$vocabularies = new \Pimple();
$vocabularies['User'] = $vocabularies->share(function () use ($app) {
$vocabularies['user'] = $vocabularies->share(function () use ($app) {
return new UserProvider($app);
});

View File

@@ -181,7 +181,7 @@ class FieldsTest extends \PhraseanetAuthenticatedWebTestCase
$body[count($body) - 1]['readonly'] = true;
$body[count($body) - 1]['required'] = false;
$response = $this->request("PUT", sprintf("/admin/fields/%d/fields", $databox->get_sbas_id()), [], [], [], json_encode($body));
$response = $this->request("PUT", sprintf("/admin/fields/%d/fields", $databox->get_sbas_id()), [], [], json_encode($body));
$this->assertEquals("application/json", $response->headers->get("content-type"));
@@ -230,7 +230,7 @@ class FieldsTest extends \PhraseanetAuthenticatedWebTestCase
'vocabulary-restricted' => true,
]);
$response = $this->request("POST", sprintf("/admin/fields/%d/fields", $databox->get_sbas_id()), [], [], [], $body);
$response = $this->request("POST", sprintf("/admin/fields/%d/fields", $databox->get_sbas_id()), [], [], $body);
$this->assertEquals("application/json", $response->headers->get("content-type"));