minmod
This commit is contained in:
parent
ce9fa0705c
commit
51038b2901
|
@ -7,6 +7,7 @@
|
||||||
use api\core\Checker;
|
use api\core\Checker;
|
||||||
use api\core\AuthSystem;
|
use api\core\AuthSystem;
|
||||||
use api\core\AuthSystemDefault;
|
use api\core\AuthSystemDefault;
|
||||||
|
use api\core\ModuleFactory;
|
||||||
use error\core\Error;
|
use error\core\Error;
|
||||||
use error\core\Err;
|
use error\core\Err;
|
||||||
|
|
||||||
|
@ -771,6 +772,25 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('fail when ModuleFactory have an error', function(){
|
||||||
|
|
||||||
|
// bypass constructor
|
||||||
|
allow(Request::class)->toReceive('buildRequestObject')->andRun(function(){
|
||||||
|
$this->error = new Error(Err::UnknownError);
|
||||||
|
});
|
||||||
|
|
||||||
|
// bypass ModuleFactory
|
||||||
|
allow(ModuleFactory::class)->toReceive('::getModule')->andRun(function(){
|
||||||
|
return new Error(Err::UnknownError);
|
||||||
|
});
|
||||||
|
|
||||||
|
$req = new Request();
|
||||||
|
$res = $req->dispatch();
|
||||||
|
expect($res)->toBeAnInstanceOf('\\api\\core\\Response');
|
||||||
|
expect($res->error->get())->toBe(Err::UnknownError);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue