aaronstoddard
08/31/2022, 7:38 PMaaronstoddard
08/31/2022, 7:44 PMbdw429s
08/31/2022, 7:46 PMaaronstoddard
08/31/2022, 7:46 PMthis.mappings[ "/model" ] = expandPath("/models");
application.wirebox = new coldbox.system.ioc.Injector('coldbox.system.ioc.config.Binder');
application.wirebox.getBinder().mapDirectory("/model");
writeDump(application.wirebox.getBinder().getMappings());
writeDump(application.wirebox.getInstance("models.userInbox.UserInboxService"));
abort;
Iaaronstoddard
08/31/2022, 7:48 PMinject="id:model.userInbox.userInboxGateway"
aaronstoddard
08/31/2022, 7:49 PMaaronstoddard
08/31/2022, 7:49 PMbdw429s
08/31/2022, 8:05 PMbdw429s
08/31/2022, 8:05 PMbdw429s
08/31/2022, 8:05 PMaaronstoddard
08/31/2022, 8:06 PMbdw429s
08/31/2022, 8:06 PMbdw429s
08/31/2022, 8:06 PMmodel
folder, but it's been models
for quite a few years now 🤔aaronstoddard
08/31/2022, 8:07 PMbdw429s
08/31/2022, 9:42 PMbdw429s
08/31/2022, 9:43 PMapplication.wirebox = new coldbox.system.ioc.Injector('coldbox.system.ioc.config.Binder');
application.wirebox.getBinder().mapDirectory("/model");
☝️ That's going on here? This isn't something you should need to be doingbdw429s
08/31/2022, 9:43 PMbdw429s
08/31/2022, 9:44 PMaaronstoddard
08/31/2022, 9:53 PMbdw429s
08/31/2022, 9:53 PMbdw429s
08/31/2022, 9:54 PMcomponent extends="testbox.system.BaseSpec" {
or whateveraaronstoddard
08/31/2022, 9:54 PMbdw429s
08/31/2022, 9:54 PMaaronstoddard
08/31/2022, 9:54 PMbdw429s
08/31/2022, 9:54 PMbdw429s
08/31/2022, 9:55 PMaaronstoddard
08/31/2022, 9:55 PMbdw429s
08/31/2022, 9:55 PMbdw429s
08/31/2022, 9:56 PMbdw429s
08/31/2022, 9:57 PMaaronstoddard
08/31/2022, 9:57 PMbdw429s
08/31/2022, 9:58 PMBaseModelTest
https://coldbox.ortusbooks.com/testing/testing-coldbox-applications/model-object-testingbdw429s
08/31/2022, 9:58 PMthis.loadColdBox=true
then you can autowire your model that's created by the base test case or just ask for a fully-wired versioon with
getInstance( 'model' )
just like if you were in your main appaaronstoddard
08/31/2022, 9:59 PMbdw429s
08/31/2022, 10:00 PMgetInstance()
to get your wired model, then you don't really need the basemodeltest. You can just use coldbox.system.testing.BaseTestCase
directly which loads ColdBox by defaultbdw429s
08/31/2022, 10:02 PMbdw429s
08/31/2022, 10:03 PMbeforeAll()
runs once, but your beforeEach()
runs before each spec which effectively means that data will never be therebdw429s
08/31/2022, 10:07 PMaaronstoddard
08/31/2022, 10:20 PMaaronstoddard
08/31/2022, 10:32 PMbdw429s
08/31/2022, 10:40 PM