This CodeIgniter Application is for testing of ci-phpunit-test.
- PHP 7.3 or later
$ git clone -b 3.x https://github.com/kenjis/ci-app-for-ci-phpunit-test.git
$ cd ci-app-for-ci-phpunit-test
$ composer update
$ ./install.php
$ ./test.sh
CodeIgniter Test Application for ci-phpunit-test
This CodeIgniter Application is for testing of ci-phpunit-test.
$ git clone -b 3.x https://github.com/kenjis/ci-app-for-ci-phpunit-test.git
$ cd ci-app-for-ci-phpunit-test
$ composer update
$ ./install.php
$ ./test.sh
Hi!
Thank for your great work.
I have tried to make test code with your library.
But I have problems when I used command line below:
./vendor/bin/phpunit -c application/tests/ application/tests/controllers/Welcome_test.php
The occured error is following:
Faild to open tream: No such file or directory in ~\ci-app-for-ci-phpunit-test\application\tests\Bootstrap.php on line 298
I am looking forward to any response from you.
Hello,
I'm trying to run this file as a test (https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.13.0/application/tests/controllers/api/Example_test.php) and here is the output that I am seeing.
PHPUnit 5.7.5 by Sebastian Bergmann and contributors.
Error: No code coverage driver is available
...[{"id":1,"name":"John","email":"[email protected]","fact":"Loves coding"},{"id":2,"name":"Jim","email":"[email protected]","fact":"Developed on CodeIgniter"},{"id":3,"name":"Jane","email":"[email protected]","fact":"Lives in the USA","0":{"hobbies":["guitar","cycling"]}}]
It looks like the tests don't run. If I comment out line 11, things seem to work (until the next $this->request). Looks like there is an issue in $this->request that is causing issues, but it wasn't obvious the issue.
Any thoughts?
Assuming I have a controller like this:
<?php
class Welcome extends CI_Controller {
public function index()
{
$solution = $this->getSolution();
echo 'The solution is ' . $solution;
}
public function getSolution()
{
return 42;
}
}
If I would like to test getSolution()
in a classical unit testing behaviour, I would call the method directly:
<?php
class Welcome_test extends TestCase
{
public function test_getSolution()
{
$testSolution = $this->request('GET', ['welcome', 'getSolution']);
$this->assertEquals(42, $testSolution);
// Failed asserting that null matches expected 200.
}
}
Unfortunately (understandably), $testSolution
is always null
as it seems to contain only output. Proof: If I echo "something";
in getSolution()
, $testSolution
equals "something"
.
So is there a way to test controller methods directly that are no route methods but simple helper methods that return something?
Or do I have to change my design to define such methods in libraries/helpers?
error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- deployer/deployer v3.0.10 requires phpseclib/phpseclib ~2.0 -> satisfiable by phpseclib/phpseclib[2.0.x-dev].
- deployer/deployer v3.0.11 requires phpseclib/phpseclib ~2.0 -> satisfiable by phpseclib/phpseclib[2.0.x-dev].
- deployer/deployer v3.0.7 requires phpseclib/phpseclib ~2.0 -> satisfiable by phpseclib/phpseclib[2.0.x-dev].
- deployer/deployer v3.0.8 requires phpseclib/phpseclib ~2.0 -> satisfiable by phpseclib/phpseclib[2.0.x-dev].
- deployer/deployer v3.0.9 requires phpseclib/phpseclib ~2.0 -> satisfiable by phpseclib/phpseclib[2.0.x-dev].
- deployer/deployer v3.1.0 requires phpseclib/phpseclib ~2.0 -> satisfiable by phpseclib/phpseclib[2.0.x-dev].
- deployer/deployer v3.1.1 requires phpseclib/phpseclib ~2.0 -> satisfiable by phpseclib/phpseclib[2.0.x-dev].
- deployer/deployer v3.1.2 requires phpseclib/phpseclib ~2.0 -> satisfiable by phpseclib/phpseclib[2.0.x-dev].
- deployer/deployer v3.2.0 requires phpseclib/phpseclib ~2.0 -> satisfiable by phpseclib/phpseclib[2.0.x-dev].
- deployer/deployer v3.2.1 requires phpseclib/phpseclib ~2.0 -> satisfiable by phpseclib/phpseclib[2.0.x-dev].
- deployer/deployer v3.3.0 requires phpseclib/phpseclib ~2.0 -> satisfiable by phpseclib/phpseclib[2.0.x-dev].
- Conclusion: don't install phpseclib/phpseclib 2.0.x-dev
- Installation request for kenjis/codeigniter-deployer 1.0.x@dev -> satisfiable by kenjis/codeigniter-deployer[1.0.x-dev].
- Conclusion: don't install symfony/config v4.0.3|install deployer/deployer v3.0.10|install deployer/deployer v3.0.11|install deployer/deployer v3.0.7|install deployer/deployer v3.0.8|install deployer/deployer v3.0.9|install deployer/deployer v3.1.0|install deployer/deployer v3.1.1|install deployer/deployer v3.1.2|install deployer/deployer v3.2.0|install deployer/deployer v3.2.1|install deployer/deployer v3.3.0
- Conclusion: remove symfony/config v4.0.3|install deployer/deployer v3.0.10|install deployer/deployer v3.0.11|install deployer/deployer v3.0.7|install deployer/deployer v3.0.8|install deployer/deployer v3.0.9|install deployer/deployer v3.1.0|install deployer/deployer v3.1.1|install deployer/deployer v3.1.2|install deployer/deployer v3.2.0|install deployer/deployer v3.2.1|install deployer/deployer v3.3.0
Can you pls help me solve this error. i can't work with inside models file of tests folder.
Code
{
protected $CI;
public function setUp() {
$this->CI = &get_instance();
$this->obj = $this->newModel('Auth_model');
}
}
Error
PHPUnit 6.5.12 by Sebastian Bergmann and contributors.
Error: No code coverage driver is available
E.. 3 / 3 (100%)G:\xampp\htdocs\hcm\admin\back-end\application
Time: 433 ms, Memory: 6.00MB
There was 1 error:
I have trouble adding it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.