Переглянути джерело

Merge pull request #4120 from greg0ire/translation_isnt_optional

Remove checks for existing translator
Oskar Stark 8 роки тому
батько
коміт
9cad37609c

+ 0 - 8
Admin/AbstractAdmin.php

@@ -2110,10 +2110,6 @@ EOT;
     {
         $domain = $domain ?: $this->getTranslationDomain();
 
-        if (!$this->translator) {
-            return $id;
-        }
-
         return $this->translator->trans($id, $parameters, $domain, $locale);
     }
 
@@ -2132,10 +2128,6 @@ EOT;
     {
         $domain = $domain ?: $this->getTranslationDomain();
 
-        if (!$this->translator) {
-            return $id;
-        }
-
         return $this->translator->transChoice($id, $count, $parameters, $domain, $locale);
     }
 

+ 0 - 14
Tests/Admin/AdminTest.php

@@ -1193,13 +1193,6 @@ class AdminTest extends \PHPUnit_Framework_TestCase
         $this->assertSame('sonata.post.admin.post', $admin->getObjectIdentifier());
     }
 
-    public function testTransWithNoTranslator()
-    {
-        $admin = new PostAdmin('sonata.post.admin.post', 'NewsBundle\Entity\Post', 'SonataNewsBundle:PostAdmin');
-
-        $this->assertSame('foo', $admin->trans('foo'));
-    }
-
     public function testTrans()
     {
         $admin = new PostAdmin('sonata.post.admin.post', 'NewsBundle\Entity\Post', 'SonataNewsBundle:PostAdmin');
@@ -1231,13 +1224,6 @@ class AdminTest extends \PHPUnit_Framework_TestCase
         $this->assertSame('fooTranslated', $admin->trans('foo', array('name' => 'Andrej'), 'fooMessageDomain'));
     }
 
-    public function testTransChoiceWithNoTranslator()
-    {
-        $admin = new PostAdmin('sonata.post.admin.post', 'NewsBundle\Entity\Post', 'SonataNewsBundle:PostAdmin');
-
-        $this->assertSame('foo', $admin->transChoice('foo', 2));
-    }
-
     public function testTransChoice()
     {
         $admin = new PostAdmin('sonata.post.admin.post', 'NewsBundle\Entity\Post', 'SonataNewsBundle:PostAdmin');

+ 1 - 1
Tests/Controller/CRUDControllerTest.php

@@ -322,7 +322,7 @@ class CRUDControllerTest extends \PHPUnit_Framework_TestCase
                     return true;
                 }
 
-                if ($id == 'security.csrf.token_manager' && Kernel::MAJOR_VERSION >= 3  && $tthis->getCsrfProvider() !== null) {
+                if ($id == 'security.csrf.token_manager' && Kernel::MAJOR_VERSION >= 3 && $tthis->getCsrfProvider() !== null) {
                     return true;
                 }