@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public function deleteByCommentIds(array $ids) |
| 16 | 16 | { |
| 17 | 17 | return $this->_em->createQueryBuilder() |
| 18 | - ->delete("MykeesCommentBundle:Comment",'c') |
|
| 18 | + ->delete("MykeesCommentBundle:Comment", 'c') |
|
| 19 | 19 | ->where("c.id IN(:ids)") |
| 20 | 20 | ->setParameter('ids', array_values($ids)) |
| 21 | 21 | ->getQuery() |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | use Liip\FunctionalTestBundle\Test\WebTestCase; |
| 13 | 13 | |
| 14 | -class CommentsControllerTest extends WebTestCase{ |
|
| 14 | +class CommentsControllerTest extends WebTestCase { |
|
| 15 | 15 | |
| 16 | 16 | protected $client; |
| 17 | 17 | protected $container; |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | public function testCountCommentHtmlList() |
| 46 | 46 | { |
| 47 | 47 | $crawler = $this->client->request('GET', '/blog/title-1'); |
| 48 | - $this->assertEquals(200,$this->client->getResponse()->getStatusCode()); |
|
| 49 | - $this->assertEquals(3,$crawler->filter('.comment-list')->count()); |
|
| 48 | + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
|
| 49 | + $this->assertEquals(3, $crawler->filter('.comment-list')->count()); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function testRemoveAssociateComment() |
| 53 | 53 | { |
| 54 | 54 | $this->client->request('GET', '/admin/delete/5'); |
| 55 | - $this->assertEquals(302,$this->client->getResponse()->getStatusCode()); |
|
| 55 | + $this->assertEquals(302, $this->client->getResponse()->getStatusCode()); |
|
| 56 | 56 | |
| 57 | 57 | $count = count($this->query_manager->findAllComments()); |
| 58 | 58 | |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function testAddComment() |
| 63 | 63 | { |
| 64 | - $crawler = $this->client->request('GET','/blog/title-1'); |
|
| 65 | - $this->assertEquals('Mvc\BlogBundle\Controller\BlogController::showAction', $this->client->getRequest()->attributes->get('_controller')); |
|
| 64 | + $crawler = $this->client->request('GET', '/blog/title-1'); |
|
| 65 | + $this->assertEquals('Mvc\BlogBundle\Controller\BlogController::showAction', $this->client->getRequest()->attributes->get('_controller')); |
|
| 66 | 66 | $form = $crawler->selectButton('Poster')->form([ |
| 67 | 67 | 'mykees_comment[username]'=>'Mykees', |
| 68 | 68 | 'mykees_comment[email]'=>'[email protected]', |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $this->client->submit($form); |
| 76 | 76 | |
| 77 | - $this->assertEquals(302,$this->client->getResponse()->getStatusCode()); |
|
| 77 | + $this->assertEquals(302, $this->client->getResponse()->getStatusCode()); |
|
| 78 | 78 | |
| 79 | 79 | $count = count($this->query_manager->findAllComments()); |
| 80 | 80 | |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public function testAddCommentWithEmptyName() |
| 85 | 85 | { |
| 86 | - $crawler = $this->client->request('GET','/blog/title-1'); |
|
| 87 | - $this->assertEquals('Mvc\BlogBundle\Controller\BlogController::showAction', $this->client->getRequest()->attributes->get('_controller')); |
|
| 86 | + $crawler = $this->client->request('GET', '/blog/title-1'); |
|
| 87 | + $this->assertEquals('Mvc\BlogBundle\Controller\BlogController::showAction', $this->client->getRequest()->attributes->get('_controller')); |
|
| 88 | 88 | $form = $crawler->selectButton('Poster')->form([ |
| 89 | 89 | 'mykees_comment[username]'=>'', |
| 90 | 90 | 'mykees_comment[email]'=>'[email protected]', |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | public function testAddCommentWithWrongEmailFormat() |
| 105 | 105 | { |
| 106 | 106 | |
| 107 | - $crawler = $this->client->request('GET','/blog/title-1'); |
|
| 107 | + $crawler = $this->client->request('GET', '/blog/title-1'); |
|
| 108 | 108 | $form = $crawler->selectButton('Poster')->form([ |
| 109 | 109 | 'mykees_comment[username]'=>'Mykees', |
| 110 | 110 | 'mykees_comment[email]'=>'contact.fr', |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | public function testAddCommmentWithAChild() |
| 126 | 126 | { |
| 127 | - $crawler = $this->client->request('GET','/blog/title-2'); |
|
| 127 | + $crawler = $this->client->request('GET', '/blog/title-2'); |
|
| 128 | 128 | |
| 129 | 129 | $form = $crawler->selectButton('Poster')->form([ |
| 130 | 130 | 'mykees_comment[username]'=>'Mykees', |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | ]); |
| 137 | 137 | $this->client->submit($form); |
| 138 | 138 | |
| 139 | - $this->assertEquals(302,$this->client->getResponse()->getStatusCode()); |
|
| 139 | + $this->assertEquals(302, $this->client->getResponse()->getStatusCode()); |
|
| 140 | 140 | |
| 141 | 141 | $count = count($this->query_manager->findAllComments()); |
| 142 | 142 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | ]); |
| 153 | 153 | $this->client->submit($form); |
| 154 | 154 | |
| 155 | - $this->assertEquals(302,$this->client->getResponse()->getStatusCode()); |
|
| 155 | + $this->assertEquals(302, $this->client->getResponse()->getStatusCode()); |
|
| 156 | 156 | |
| 157 | 157 | $count = count($this->query_manager->findAllComments()); |
| 158 | 158 | $this->assertEquals(7, $count); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | public function testPreDeleteComment() |
| 167 | 167 | { |
| 168 | - $crawler = $this->client->request('GET','/blog/title-1'); |
|
| 168 | + $crawler = $this->client->request('GET', '/blog/title-1'); |
|
| 169 | 169 | $form = $crawler->selectButton('Poster')->form([ |
| 170 | 170 | 'mykees_comment[username]'=>'Mykees', |
| 171 | 171 | 'mykees_comment[email]'=>'[email protected]', |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | 'mykees_comment[modelId]'=>25, |
| 176 | 176 | ]); |
| 177 | 177 | $this->client->submit($form); |
| 178 | - $this->assertEquals(302,$this->client->getResponse()->getStatusCode()); |
|
| 178 | + $this->assertEquals(302, $this->client->getResponse()->getStatusCode()); |
|
| 179 | 179 | $count = count($this->query_manager->findAllComments()); |
| 180 | 180 | $this->assertEquals(6, $count); |
| 181 | 181 | |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | |
| 192 | - public function testWithCommentDepthToZero(){ |
|
| 192 | + public function testWithCommentDepthToZero() { |
|
| 193 | 193 | $crawler = $this->client->request('GET', '/blog/title-1'); |
| 194 | - $this->assertEquals(200,$this->client->getResponse()->getStatusCode()); |
|
| 195 | - $this->assertEquals(0,$crawler->filter('.reply')->count()); |
|
| 194 | + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
|
| 195 | + $this->assertEquals(0, $crawler->filter('.reply')->count()); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | } |
| 199 | 199 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | use Symfony\Component\Validator\Constraints\DateTime; |
| 13 | 13 | |
| 14 | -class CommentExtension extends \Twig_Extension{ |
|
| 14 | +class CommentExtension extends \Twig_Extension { |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Returns a list of functions to add to the existing list. |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | - public function commentForm(\Twig_Environment $env, $form, $ajax=false, $options=[]) |
|
| 45 | + public function commentForm(\Twig_Environment $env, $form, $ajax = false, $options = []) |
|
| 46 | 46 | { |
| 47 | - return $env->render('MykeesCommentBundle:Comments:form.html.twig',[ |
|
| 47 | + return $env->render('MykeesCommentBundle:Comments:form.html.twig', [ |
|
| 48 | 48 | 'form'=>$form, |
| 49 | 49 | 'ajax'=>$ajax, |
| 50 | 50 | 'options'=>$options |
@@ -58,16 +58,16 @@ discard block |
||
| 58 | 58 | * @param bool $canAdminComment |
| 59 | 59 | * @return string |
| 60 | 60 | */ |
| 61 | - public function commentsList(\Twig_Environment $env,$comments, $canAdminComment=false, $options=[]) |
|
| 61 | + public function commentsList(\Twig_Environment $env, $comments, $canAdminComment = false, $options = []) |
|
| 62 | 62 | { |
| 63 | - return $env->render('MykeesCommentBundle:Comments:comments.html.twig',[ |
|
| 63 | + return $env->render('MykeesCommentBundle:Comments:comments.html.twig', [ |
|
| 64 | 64 | 'comments'=>$comments, |
| 65 | 65 | "canAdminComment"=>$canAdminComment |
| 66 | 66 | ]); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - public function dateInterval($date,$locale) |
|
| 70 | + public function dateInterval($date, $locale) |
|
| 71 | 71 | { |
| 72 | 72 | $comment_date = new \DateTime($date); |
| 73 | 73 | $dateNow = new \DateTime('NOW'); |
@@ -81,25 +81,25 @@ discard block |
||
| 81 | 81 | $interval->format('%i') |
| 82 | 82 | ]; |
| 83 | 83 | $unity_en = [ |
| 84 | - ['year','years'], |
|
| 85 | - ['month','months'], |
|
| 86 | - ['day','days'], |
|
| 87 | - ['hour','hours'], |
|
| 88 | - ['minute','minutes'] |
|
| 84 | + ['year', 'years'], |
|
| 85 | + ['month', 'months'], |
|
| 86 | + ['day', 'days'], |
|
| 87 | + ['hour', 'hours'], |
|
| 88 | + ['minute', 'minutes'] |
|
| 89 | 89 | ]; |
| 90 | 90 | $unity_fr = [ |
| 91 | - ['an','ans'], |
|
| 92 | - ['mois','mois'], |
|
| 93 | - ['jour','jours'], |
|
| 94 | - ['heure','heures'], |
|
| 95 | - ['minute','minutes'] |
|
| 91 | + ['an', 'ans'], |
|
| 92 | + ['mois', 'mois'], |
|
| 93 | + ['jour', 'jours'], |
|
| 94 | + ['heure', 'heures'], |
|
| 95 | + ['minute', 'minutes'] |
|
| 96 | 96 | ]; |
| 97 | 97 | |
| 98 | 98 | $periodesLength = count($periodes); |
| 99 | 99 | |
| 100 | - for($i=0; $i < $periodesLength; $i++) |
|
| 100 | + for ($i = 0; $i < $periodesLength; $i++) |
|
| 101 | 101 | { |
| 102 | - if(intval($periodes[$i]) >= 1 && $i < count($periodes)) |
|
| 102 | + if (intval($periodes[$i]) >= 1 && $i < count($periodes)) |
|
| 103 | 103 | { |
| 104 | 104 | $locale_unity = $locale == "fr" ? $unity_fr : $unity_en; |
| 105 | 105 | $u = $periodes[$i] > 1 ? $locale_unity[$i][1] : $locale_unity[$i][0]; |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | return $periodes[$i].' '.$u; |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | - if($locale == 'fr') |
|
| 110 | + if ($locale == 'fr') |
|
| 111 | 111 | { |
| 112 | 112 | return "moins d'une minute"; |
| 113 | - }else{ |
|
| 113 | + }else { |
|
| 114 | 114 | return 'less than a minute'; |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | |
| 15 | - public function md5 ( $val ){ |
|
| 15 | + public function md5($val) { |
|
| 16 | 16 | return md5($val); |
| 17 | 17 | } |
| 18 | 18 | |