From c8063fa136cfa9ca9c3f76d08645863c4e20f967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= Date: Wed, 30 Mar 2016 17:42:46 +0200 Subject: [PATCH] fix service lookup in lower-case --- lib/Alchemy/Phrasea/Controller/Admin/FieldsController.php | 2 +- lib/Alchemy/Phrasea/ControllerProvider/Admin/Fields.php | 2 +- tests/Alchemy/Tests/Phrasea/Controller/Admin/FieldsTest.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Admin/FieldsController.php b/lib/Alchemy/Phrasea/Controller/Admin/FieldsController.php index 85b1fe1731..c13efa100d 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/FieldsController.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/FieldsController.php @@ -129,7 +129,7 @@ class FieldsController extends Controller { $vocabularies = $this->getVocabularies(); - $vocabulary = $vocabularies[$type]; + $vocabulary = $vocabularies[strtolower($type)]; Assertion::isInstanceOf($vocabulary, ControlProviderInterface::class); diff --git a/lib/Alchemy/Phrasea/ControllerProvider/Admin/Fields.php b/lib/Alchemy/Phrasea/ControllerProvider/Admin/Fields.php index 4d921391ba..b6f111a37a 100644 --- a/lib/Alchemy/Phrasea/ControllerProvider/Admin/Fields.php +++ b/lib/Alchemy/Phrasea/ControllerProvider/Admin/Fields.php @@ -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); }); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/FieldsTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/FieldsTest.php index 423b10966f..8e10b1842c 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/FieldsTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/FieldsTest.php @@ -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"));