Welcome Guest, Not a member yet? Register   Sign In
ci-phpunit-test for CodeIgniter 3.0
#89
Star 

(04-22-2018, 05:42 AM)kenjis Wrote: Hi,

I've just released ci-phpunit-test v0.16.1.
It is a bug fix release.

https://github.com/kenjis/ci-phpunit-test/releases

Hi Kenjis,

I am facing the issue of NO TestCase class found. 

What I have done:

1. Installed Codeigniter 3.1.9
2. Unzipped and placed Application/tests from ci-phpunit-test-0.16.1 to my application folder.

Created Hello.php inside application/controllers as follows :


PHP Code:
<?php
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class Hello {
    public function get_hello()
    {
        $this->load->view('Hello_view'); 
    
}


Created Hello_test.php inside application/tests/controllers as follows:


PHP Code:
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class Hello_test extends TestCase{
    public function test_get_hello() {
        $output $this->request('GET',['Hello','get_hello']);
        $expected '<h2>Hello!</h2>';
        
        $this
->assertContains($expected,$output);
    }


Folder structure as follows:
   

From netbeans used Alt+F6 for test as well as tried from terminal by going into application/tests and using phpunit command.
Getting below output 

"C:\xampp\php\php.exe" "C:\xampp\php\phpunit" "--colors" "--log-json" "C:\Users\SOUMYA~1\AppData\Local\Temp\nb-phpunit-log.json" "C:\Program Files\NetBeans 8.2\php\phpunit\NetBeansSuite.php" "--" "--run=C:\xampp\htdocs\SAMPLE_PHPUNIT\application\tests"


Code:
An uncaught Exception was encountered

Type:        Error
Message:     Call to undefined function PhpParser\canonicalize()
Filename:    C:\xampp\htdocs\SAMPLE_PHPUNIT\application\tests\vendor\nikic\php-parser\test\PhpParser\CodeTestAbstract.php
Line Number: 17

Backtrace:
File: C:\xampp\htdocs\SAMPLE_PHPUNIT\application\tests\vendor\nikic\php-parser\test\PhpParser\CodeParsingTest.php
Line: 60
Function: getTests

File: C:\xampp\php\pear\PHPUnit\Util\Test.php
Line: 263
Function: invoke

File: C:\xampp\php\pear\PHPUnit\Framework\TestSuite.php
Line: 480
Function: getProvidedData

File: C:\xampp\php\pear\PHPUnit\Framework\TestSuite.php
Line: 834
Function: createTest

File: C:\xampp\php\pear\PHPUnit\Framework\TestSuite.php
Line: 212
Function: addTestMethod

File: C:\xampp\php\pear\PHPUnit\Framework\TestSuite.php
Line: 315
Function: __construct

File: C:\xampp\php\pear\PHPUnit\Framework\TestSuite.php
Line: 389
Function: addTestSuite

File: C:\Program Files\NetBeans 8.2\php\phpunit\NetBeansSuite.php
Line: 85
Function: addTestFile

File: C:\xampp\php\pear\PHPUnit\Runner\BaseTestRunner.php
Line: 124
Function: invoke

File: C:\xampp\php\pear\PHPUnit\TextUI\Command.php
Line: 149
Function: getTest

File: C:\xampp\php\pear\PHPUnit\TextUI\Command.php
Line: 129
Function: run

File: C:\xampp\php\phpunit
Line: 46
Function: main


Done.

Kindly help me what am I missing. 

Thank you
Reply


Messages In This Thread
ci-phpunit-test for CodeIgniter 3.0 - by kenjis - 05-09-2015, 11:33 PM
RE: ci-phpunit-test for CodeIgniter 3.0 - by soumyaranjanr - 12-06-2018, 02:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB