Brent
07/03/2024, 5:01 PMmockBox.createStub(extends="path.to.my.s3service");
That will create a fake S3 service that mirrors the interface etc of my service but not actually do anything, right?
Do I need to call init() on that as well to instantiate it?Brent
07/03/2024, 5:02 PMapplication.mockS3 = mockBox.createStub(extends="path.to.my.service").init(...some props);
jclausen
07/03/2024, 5:18 PMcreateEmptyMock
instead: https://testbox.ortusbooks.com/mocking/mockbox/creating-a-mock-object#createemptymockBrent
07/03/2024, 5:20 PMjclausen
07/03/2024, 5:36 PMBrent
07/03/2024, 6:11 PMcreateStub()
it will instantiate the class that is set to extends
passed in automatically? (I notice different behavior when I append .init()
to createStub vs. leave it off, so not sure if it's already doing that)aliaspooryorik
createMock
as well which preserves the signatures and is what I use most of the timealiaspooryorik
createMock
or createEmptyMock
call the init
method but you'll get back the object (either with methods or without)Brent
07/03/2024, 7:03 PM.init()
or new up the mocked object after using createMock etc.? Or does it matter?
Use case is passing the service or mocked component into another component under test (the mock/test double is a dependency the sut requires).aliaspooryorik
Brent
07/03/2024, 7:30 PM