', function(){ $err = ModuleFactory::getModule(11); expect($err)->toBeAnInstanceOf('\\error\\core\\Error'); expect($err->get())->toBe(Err::WrongParam); }); it('fail if @arguments is not an ', function(){ $err = ModuleFactory::getModule('someMod', 12); expect($err)->toBeAnInstanceOf('\\error\\core\\Error'); expect($err->get())->toBe(Err::WrongParam); }); it('pass if @arguments not given (default value)', function(){ $err = ModuleFactory::getModule('bla'); expect($err)->toBeAnInstanceOf('\\error\\core\\Error'); expect($err->get())->not->toBe(Err::WrongParam); }); it('fail if @module implementation file does not exist', function(){ allow('file_exists')->toBeCalled()->andReturn(false); $err = ModuleFactory::getModule('bla'); expect($err)->toBeAnInstanceOf('\\error\\core\\Error'); expect($err->get())->toBe(Err::UncallableModule); }); it('fail if @module implementation file exists but instanciation fails', function(){ allow('file_exists')->toBeCalled()->andReturn(true); $err = ModuleFactory::getModule('bla'); expect($err)->toBeAnInstanceOf('\\error\\core\\Error'); expect($err->get())->toBe(Err::UncallableModule); }); it('pass if @module implementation file exists and instanciation succeeds', function(){ allow('file_exists')->toBeCalled()->andReturn(true); // normally the 'module' module is always here for testing purposes $err = ModuleFactory::getModule('documentationDefault'); expect($err)->not->toBeAnInstanceOf("\\error\\core\\Error"); }); }); }); }); });