Browse Source

Adding LearnPathControllerTest

Julio Montoya 12 years ago
parent
commit
0a833f12cf

+ 3 - 0
main/inc/lib/internationalization.lib.php

@@ -126,6 +126,9 @@ $_api_is_translated_call = false;
 function get_lang($variable, $reserved = null, $language = null)
 {
     global $app;
+    if ($app['debug']) {
+        //return $variable;
+    }
     $translated = $app['translator']->trans($variable);
     if ($translated == $variable) {
         $translated = $app['translator']->trans("lang$variable");

+ 34 - 0
tests/phpunit/LearnpathControllerTest.php

@@ -0,0 +1,34 @@
+<?php
+namespace ChamiloLMS\Controller;
+use Silex\WebTestCase;
+
+/**
+ * Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2013-03-07 at 12:15:50.
+ */
+class LearnpathControllerTest extends WebTestCase
+{
+    /**
+     * @return mixed|\Symfony\Component\HttpKernel\HttpKernel
+     */
+    public function createApplication()
+    {
+        $app = require '../../main/inc/global.inc.php';
+        $app['debug'] = true;
+        $app['exception_handler']->disable();
+        $app['monolog'] = $this->getMock('Monolog\Logger');
+
+        return $app;
+    }
+
+    /**
+     * @covers ChamiloLMS\Controller\LearnpathController::indexAction
+     * @todo   Implement testIndexAction().
+     */
+    public function testIndexAction()
+    {
+        $client = $this->createClient();
+        $crawler = $client->request('GET', '/');
+        $this->assertTrue($client->getResponse()->isOk());
+        $this->assertCount(1, $crawler->filter('form'));
+    }
+}