Welcome Guest, Not a member yet? Register   Sign In
How to use PHPUnit (CIUnit) with CodeIgniter 2.1.0
#11

[eluser]rubdottocom[/eluser]
Hi!

I have another (probably) newbie question ^^

I'm trying to test models with a test database using fixtures, but I have tables with Foreign Keys and I receive errors about I can't truncate tables referenced in a foreign key

I read about it and it seems a standard restriction, I could delete all rows but I can't truncate a table with FK's unless I disable the FK first.

Any advice? Sad
#12

[eluser]kenjis[/eluser]
The way to truncate the tables in CIUnit is not good.
Any contributions is welcome. :-)
#13

[eluser]royalgiant[/eluser]
Code:
PHP Warning:  require_once(PHP/CodeCoverage/Autoload.php): failed to open stream: No such file or directory in /usr/lib/php/PHPUnit/Autoload.php on line 46
PHP Fatal error:  require_once(): Failed opening required 'PHP/CodeCoverage/Autoload.php' (include_path='.:') in /usr/lib/php/PHPUnit/Autoload.php on line 46

I keep getting this error. Does anyone know how to fix it? It happens when i run phpunit
#14

[eluser]Lechuss[/eluser]
Code:
public function testRepeat()
    {
        $yell = "Hello, any one out there?";
        $returned = $this->CI->repeat($yell);
        $this->assertEquals($returned, $yell);
    }

..PHP Fatal error: Call to undefined method Welcome::repeat() in /opt/bitnami/frameworks/codeigniter/tests/controllers/WelcomeControllerTest.php on line 20
#15

[eluser]Unknown[/eluser]
I am trying to integrate ciunit, I followed the kenjis tutorials from http://d.hatena.ne.jp/Kenji_s/20120117/1326763908.

But I got following error:
Fatal error: Class 'CIUnit_TestCase' not found


Here I show how I run test file in my command line(in windows pc).

D:\xampp\php>phpunit D:\xampp\htdocs\programmerz\tests\models\PhoneCarrierModelTest.php

I don't understand where i am wrong. I guess PhoneCarrierModelTest.php file failed to loaded phpunit.xml file in tests folder. For that, it failed to include ../application/third_party/CIUnit/bootstrap_phpunit.php file.


Please help me. Where I left some settings.
#16

[eluser]SPeed_FANat1c[/eluser]
I am getting errors when updating pear. I don't understand.

C:\Users\Darius>pear channel-update pear.phpunit.de
Updating channel "pear.phpunit.de"
PEAR_Config::writeConfigFile fopen('C:\Windows\pear.ini','w') failed (fopen(C:\W
indows\pear.ini): failed to open stream: Permission denied)

C:\Users\Darius>pear channel-update pear.phpunit.de
ERROR: The default config file is not a valid config file or is corrupted.

At first it says that it failed to open streatm. I go to windows directory - there is no such file so I create it.

After creating, it is empty, and it says it is corrupted.

Isn't there more normal way to install update of pear, wihtout manually creating files and without knowing how the file should look?
#17

[eluser]jmadsen[/eluser]
There is an unofficial composer package:

https://packagist.org/packages/EHER/PHPUnit

I agree - PEAR on Windows is not any fun
#18

[eluser]SPeed_FANat1c[/eluser]
@jmadsen - thanks, somehow next day I tried again and upgrading pear worked Smile don't know what I did wrong before.

Now another question - how to download CIUNIT for CI 2.1.0? I downloaded but it is for older versions - 1.7 and so on. 2.0.3 version is ok.

When I go to Download > branches 2.1.0

https://bitbucket.org/kenjis/my-ciunit/c...b91aeed768

there is nothing to download.

I also tried Downloads > Tags > v0.16

but from there as I said I download old version.

I see in the page:

"default" branch is for CodeIgniter 2.1.0.
To CodeIgniter 2.0.3 users, please use "CI 2.0.3" branch. You can get the latest code from https://bitbucket.org/kenjis/my-ciunit/get/CI 2.0.3.zip

So for 2.0.3 there is a link. But where is for 2.1.0????????

I also tried clone:


C:\Users\Darius\Desktop\siuksles>hg clone https://bitbucket.org/kenjis/my-ciunit

'hg' is not recognized as an internal or external command,
operable program or batch file.

I don't know what is hg, maybe windows does not support it or what. Anyway there should be normal link to download I think.
#19

[eluser]jmadsen[/eluser]
"hg" is Mercurial, similar to svn or git

http://mercurial.selenic.com/downloads/

should get you a client so you can clone; I don't use it much & am not sure if there's a quicker way
#20

[eluser]SPeed_FANat1c[/eluser]
thanks Smile

BTW there was another command

$ wget https://bitbucket.org/kenjis/my-ciunit/get/default.zip

again wget does not work in my system, but I copied the url into browser and download worked, so Mercurial is not needed I guess.

Now I will try to execute them and will check if the instalation will work Smile

Edit:
btw in case someone iinterested, I installed gow to execute linux commands on windows

http://ashu-geek.blogspot.com/2012/01/ho...ds-on.html

but still I cannot find how to execute .sh file with that program.




Theme © iAndrew 2016 - Forum software by © MyBB