-
-
Save Rayne/5afcf404d334465850db to your computer and use it in GitHub Desktop.
<?php | |
class F3PHPUnitTest extends PHPUnit_Framework_TestCase { | |
public function test() { | |
$f3 = Base::instance(); | |
// Don't write to STDOUT | |
$f3->set('QUIET', true); | |
$f3->route('GET /path', function(){ echo 'TEXT'; }); | |
$this->assertNull($f3->mock('GET /path')); | |
$this->assertSame('TEXT', $f3->get('RESPONSE')); | |
} | |
} |
I'm having trouble mocking a Controller route
$f3->route('GET /epr/reports/aspectslug/sales', '\controllers\epr\ReportController->index');
mocking this route give a 404
$f3->mock('GET /epr/reports/aspectslug/sales');
This is an example.
could it be the path of the controller that not correct "\controllers\epr\ReportController->index"
It is indeed possible that the controller's path or file name is wrong. Double check your AUTOLOAD
and - if used - Composer configuration. Join us on Slack to tackle your problem.
Hello,
I have a problem with mock and phpunit
when I use base->mock() Assertion did not work $this->expectOutputString.
look here https://stackoverflow.com/questions/61594665/how-to-use-expectoutputstring-phpunits/61594808#61594808
For the record, this is not the whole problem, I hope it's not problem.
More details and another example are available at: Unit Testing with Fat-Free-Framework