Welcome Guest, Not a member yet? Register   Sign In
Unit Testing with phpUnit (models+controllers+fixtures) - want it?
#21

[eluser]rafsoaken[/eluser]
[quote author="spyro" date="1230023078"]I setup foostack 0.12 and received the following error.

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message: Undefined index: spyc</p>
<p>Filename: libraries/Controller.php</p>
<p>Line Number: 300</p>

</div>
Fatal error: Cannot access empty property in C:\xampp\htdocs\\system
\application\libraries\Controller.php on line 301


My environment is running in XAMPP and I am using the HMVC extension. The HMVC part might be what is effecting foostack.

Any ideas on how to fix this?[/quote]

hi spyro,
CIUnit was not tested against HMVC. As far as I know affects HMVC the way controllers are loaded, breaking the load mechanism of CodeIgniter that CIUnit is assuming.
I don't know how much effort it would require to reconcile the two - but if anyone makes the effort, I'd be more than happy to add this change to CIUnit.
cheers
raf
#22

[eluser]spyro[/eluser]
[quote author="rafsoaken" date="1230099028"]

hi spyro,
CIUnit was not tested against HMVC. As far as I know affects HMVC the way controllers are loaded, breaking the load mechanism of CodeIgniter that CIUnit is assuming.
I don't know how much effort it would require to reconcile the two - but if anyone makes the effort, I'd be more than happy to add this change to CIUnit.
cheers
raf[/quote]

I am going to see what I can figure out. Unfortunately I am still new to CI and haven't messed around with extending core functionality. This is why I posted, to see if someone could start me in the right direction to begin figuring out how to get the two to work together.
#23

[eluser]bhogg[/eluser]
For some reason the result of output() is always an empty string. The output is not being displayed on screen so it is likely being captured somewhere.

I can capture the output from an individual view, but would be nice to test the output from a call to a controller function too.

Anyone else had this issue?

Cheers,
Brian
#24

[eluser]Eric Saboia[/eluser]
I need to do all steps (replace Codeigniter.php, add lines in my database.php, etc) every time to make my tests? and after i will need return this steps to get my normal work aplication again?

Sorry for my bad english, and thanks for share this project!
#25

[eluser]bhogg[/eluser]
You do it just once - those changes become part of the core of the application you're building. I don't think it will be a noticable difference in performance, but you can always strip it out again in the release version.
#26

[eluser]Eric Saboia[/eluser]
When i run my test, i receive this message:
Strict Standards: Only variables should be passed by reference in C:\xampp\htdoc
s\frameworks\ci\system\application\libraries\tests\CIUnit.php on line 66

My test is:
Code:
include_once dirname(__FILE__).'/../CIUnit.php';

class Cliente_modelTest extends CIUnit_TestCase
{
    protected $cliente;

    protected function setUp()
    {
        $this->CI->load->model('Cliente_model', 'pm');
        $this->cliente = $this->CI->pm;
    }


    public function testInserir()
    {
        try {
            $this->cliente->insert();
        } catch (Exception $e) {
            return;
        }
        
        $this->fail();
    }
}

What can be wrong? Thanks!
#27

[eluser]Eric Saboia[/eluser]
Oh... i was trying to put "tests" into /libraries/ directory, now i have put on application/ directory and my problem has changed:

C:\xampp\php>phpunit C:\xampp\htdocs\frameworks\ci\system\application\tests\mode
ls\Cliente_modelTest.php

Strict Standards: Assigning the return value of new by reference is deprecated i
n C:\xampp\htdocs\frameworks\ci\system\application\libraries\fooStack\fooBase\Co
mmon.php on line 170

Strict Standards: Assigning the return value of new by reference is deprecated i
n C:\xampp\htdocs\frameworks\ci\system\application\libraries\fooStack\fooBase\Co
mmon.php on line 179

Strict Standards: Assigning the return value of new by reference is deprecated i
n C:\xampp\htdocs\frameworks\ci\system\application\libraries\fooStack\fooBase\Co
mmon.php on line 279

Strict Standards: Assigning the return value of new by reference is deprecated i
n C:\xampp\htdocs\frameworks\ci\system\application\libraries\fooStack\fooBase\Co
mmon.php on line 288

Strict Standards: Assigning the return value of new by reference is deprecated i
n C:\xampp\php\PEAR\Config.php on line 80

Strict Standards: Assigning the return value of new by reference is deprecated i
n C:\xampp\php\PEAR\Config.php on line 166

Strict Standards: Assigning the return value of new by reference is deprecated i
n C:\xampp\php\PEAR\Config\Container.php on line 111

Any idea? Thanks!
#28

[eluser]bwuk[/eluser]
Hi,

I've installed CIUnit and PHPUnit. However, when I run:

Code:
phpunit --verbose AllTests.php

I get the following error:

Code:
Fatal error: Call to undefined function foo_config() in ${my_wwwroot}\system\application\libraries\fooStack\fooBase\Common.php on line 98

I've looked at the file, and I can see that it's including the config.php which defines the function 'foo_config', but still it errors.

Any advice anyone?


Thanks


bwuk
#29

[eluser]rafsoaken[/eluser]
Hi everyone,
A new version (v0.13) of CIUnit is released! Get it here!

Thanks for the very positive feedback to CIUnit! A couple of bugs have been fixed (like the one from the previous post) and testing your CodeIgniter application should now be more fun than ever!

cheers
raf

PS: Thanks to everyone who helped hunting down bugs and gave feedback!
#30

[eluser]Eric Saboia[/eluser]
I downloaded the new version and now i have this error:
Class CIUnit_TestCase could not be found in C:\xampp\htdocs\frameworks\ci\system
\application\tests\AllTests.php.




Theme © iAndrew 2016 - Forum software by © MyBB