2

我终于能够在我的本地 Windows 安装上运行 mxunit 和模拟,但是在系统管理员在我们的 Linux 服务器上安装它之后,我只有在使用它时才会收到以下错误。它适用于另一个不需要模拟的应用程序。

违规代码:

mockLogger = getMockBox().createMock('coldbox.system.logging.Logger');
mockLogger.$("info").$("debug").$("warn").$("error");
model.$property(propertyName="logger", mock=mockLogger);

错误:

/shared/coldbox/system/testing/stubs/9DA00BFE-CBB2-164D-DAB9269585B3E317.cfm (Permission denied)

我应该在我的 test/Application.cfc 中设置什么吗?

4

1 回答 1

0

The error is because MXUnit / Mockbox is trying to create the file specified, but CF doesn't have permission to write to that location.

The usual fix for this would be to update the permissions for that stubs directory, so that CF can write and access the files there. (Use chown/chmod, or ask the sys admin to do it.)

The other option is to use a different location which CF does have permission to. You can set this by passing the generationPath argument to MockBox when you initialise it, either...

new coldbox.system.testing.MockBox( generationPath="path" )

... if you're initialising it yourself, or from a unit test...

getMockBox().init( generationPath="path" )

The path provided needs to be relative - i.e. something cfinclude can use, so it might be worth setting up a mapping.

于 2013-10-11T22:05:17.003 回答