Play框架使用
activator test
Run Code Online (Sandbox Code Playgroud)
运行所有测试.
如何将Java System属性传递给我的测试用例.以下方法无效
activator -Dsettings="/settings/settings.json" test
Run Code Online (Sandbox Code Playgroud)
巧合的是,如果我使用~run命令,上述内容将起作用.
我已经阅读过这个问题了,但它只适用于该play
命令
我发生了以下查询
public function test()
{
$uuid = substr( String::uuid() , 4 , rand( 7 , 10 ) );
$name = $uuid;
$event = $this->Event->getEvent( array( "event_id" => "5240e695-9acc-4e32-9b98-1aecb3d0838" ) );
$event[ "event_name" ] = $name;
$this->Event->update( $event );
debug( $this->Event->search( array( "event_id" => $event[ "event_id"] ) )[ 0 ][ "event_name" ] );
debug( $this->Event->search( array( "event_id" => $event[ "event_id"] , "limit" => 1 ) )[ 0 ][ "event_name" ] );
}
Run Code Online (Sandbox Code Playgroud)
我为从mySQL(InnoDB)表中检索的特定事件分配一个随机名称event,为其分配一个随机的新名称,并将其保存回数据库中.
当我在此代码中运行最后两个语句时,结果不一样,请注意第二个查询中的最后一个参数只是将LIMIT 1添加到第二个查询的末尾.(我没有使用CakePHP 2.x搜索表的典型方法).第一次搜索调用的结果将产生先前请求的先前结果,而第二次搜索调用将在event表中产生实际当前更新的名称.
我一直在寻找如何从数据源对象中删除查询缓存COMPLETELY,但无法弄清楚如何.我已经尝试在数据源对象上使用flushMethodCache(),但它什么也没做,我试过设置 …
我在Play Framework 2.2.3中有以下文件
控制器:
public class Comment extends Controller
{
public Result create(UUID id)
{
models.blog.Blog blog = models.blog.Blog.finder.byId(id);
Result result;
if(blog == null)
{
result = notFound(main.render("404", error404.render()));
}
else
{
Form<models.blog.Comment> commentForm = Form.form(models.blog.Comment.class);
commentForm = commentForm.bindFromRequest();
if(commentForm.hasErrors())
{
result = badRequest(Json.toJson(commentForm));
}
else
{
models.blog.Comment comment = commentForm.get();
comment.setId(UUID.randomUUID());
comment.setTimeCreated(new Date());
comment.setBlogId(blog.getId());
comment.save();
result = ok(Json.toJson(comment));
}
}
return result;
}
}
Run Code Online (Sandbox Code Playgroud)
还有两个型号
@Entity
@Table(name="blog")
public class Blog extends Model
{
private static final SimpleDateFormat MONTH_LITERAL = …Run Code Online (Sandbox Code Playgroud)