Welcome Guest, Not a member yet? Register   Sign In
Unit Testing Library - Help :)
#1

[eluser]Unknown[/eluser]
Hello There,

I am using https://github.com/Xeoncross/Testify.php and trying to create a unit testing system so that I can do calls to controller/model functions and "then do isEqual or what not on the results".

However I am a bit confused as to how to make calls to controllers/models and include the default CI variables so they can be called exactly like they would in a normal CI instance.

So I could do maybe

Code:
<?php

require __DIR__.'/src/Testify.php';
require __DIR__.'/codeigniter/controllers/controller.php';

$tf = new Testify("Test Suite");

$tf->Test(function($tf) {
  $tf->isEqual($this->controllerFunction($variables),1);
});

Or something. Any pointers/help?
#2

[eluser]aquary[/eluser]
CI has its own unit testing library, read the userguide.

Though, I've never use any of unit testing, cannot comment any further.
#3

[eluser]Dan Bowling[/eluser]
To work more directly with CI, you might try Jens Roland's TOAST (http://jensroland.com/projects/toast/)

I've made some changes to my copy to support PHPUnit's syntax (https://bitbucket.org/dbowling/toaster)

Testing controllers in CodeIgniter is hard, but you shouldn't have much logic in them anyways... testing models, libraries, and helpers is what's important.




Theme © iAndrew 2016 - Forum software by © MyBB