我尝试为我的应用程序编写功能测试但是我收到以下错误:
InvalidArgumentException: The option "test_case" must be set.
Run Code Online (Sandbox Code Playgroud)
我试着谷歌搜索它,但发现字面上没有线索.
我的代码:
class WhateverTest extends WebTestCase {
public function testWhatever() {
$client = static::createClient();
$crawler = $client->request('GET', '/home');
$this->assertEquals(1, 1);
}
Run Code Online (Sandbox Code Playgroud)
在phpunit.xml中设置了内核
<php>
<server name="KERNEL_DIR" value="app/" />
</php>
Run Code Online (Sandbox Code Playgroud)
我AppKernel只有两个功能:registerBundles()和registerContainerConfiguration
就像在标题中一样.我尝试使用云形成将API网关方法与SQS集成.我缺少的是SQS的正确URI.如果你们中的任何人已经这样做了,那么URI应该是什么样的?
我想出了类似的东西,但不知道在哪里放置SQS ARN
"arn:aws:apigateway:${AWS::Region}:sqs:action/SendMessage"
Run Code Online (Sandbox Code Playgroud)
以下是该方法的完整配置:
PostMethod:
Type: "AWS::ApiGateway::Method"
Properties:
ApiKeyRequired: "true"
HttpMethod: "POST"
ResourceId: !Ref "SomeResource"
RestApiId: !Ref "SomeRestApi"
Integration:
IntegrationHttpMethod: "POST"
IntegrationResponses:
- StatusCode: 200
Type: "AWS"
Uri: "arn:aws:apigateway:${AWS::Region}:sqs:action/SendMessage"
Run Code Online (Sandbox Code Playgroud)
如果你与lambda函数集成,这里是一个URI的例子:
arn:aws:apigateway:us-west-2:lambda:path//2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:function_name/invocations
-
Run Code Online (Sandbox Code Playgroud) 从官方文档(http://symfony.com/doc/current/quick_tour/the_view.html#embedding-other-controllers)我学习了如何在Twig模板中嵌入Controller.
Controller注入属性时出现问题.有没有办法使用render(controller())具有构造函数的控制器的Twig 函数?
当我尝试以下时:
{{ render(controller(
'SomeBundle:Some:renderList',
{ 'request': app.request }
)) }}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Missing argument 1 for SomeBundle\Controller\SomeController::__construct()
此Controller的构造函数如下所示:
public function __construct($container, SomeService $someService) {
parent::__construct($container);
$this->someService = $someService;
}
Run Code Online (Sandbox Code Playgroud)
注入容器和someService在service.yml中配置.
所以,我的问题是:当控制器使用依赖注入时,如何在Twig的模板中嵌入控制器?
UPDATE
我可以这样做:
{{ render(app.request.baseUrl ~ '/some/route') }}
但我想避免制作路线.
更新2
service.yml的服务定义
some.controller:
class: SomeBundle\Controller\SomeController
arguments: ["@service_container", "@some.service"]
Run Code Online (Sandbox Code Playgroud) 我尝试将属性从文件加载到 Properties 类中。我希望这个解决方案能够工作: How to load property file from classpath in AWS lambda java
\n\n我有一个带有很少静态方法的类,我想将其用作配置持有者。里面有这么一行
\n\nfinal InputStream inputStream = \nConfig.class.getClass().getResourceAsStream("/application-main.properties");\nRun Code Online (Sandbox Code Playgroud)\n\n并且它总是返回 null。我下载了 Lambda 使用的 zip 包,该文件位于根目录中。尽管如此,还是不行。
\n\n有人有类似的问题吗?
\n\n编辑:\n配置文件在这里:
\n\nproject\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80src\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80main\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80resources\n\xe2\x94\x82 application-main.properties\nRun Code Online (Sandbox Code Playgroud)\n\n编辑:\n我的“临时”解决方法如下所示:
\n\n// LOAD PROPS FROM CLASSPATH...\ntry (InputStream is = Config.class.getResourceAsStream(fileName)) {\n PROPS.load(is);\n } catch (IOException|NullPointerException exc) {\n // ...OR FROM FILESYSTEM\n File file = new File(fileName);\n try (InputStream is = new FileInputStream(file)) {\n PROPS.load(is);\n } catch (IOException exc2) {\n throw …Run Code Online (Sandbox Code Playgroud) 就像标题一样。我只能使用 Cloud Formation 在 AWS 上部署东西。现在我尝试使用 API 密钥保护我的 API 网关,看起来我需要一个使用计划。此处的文档似乎并未涵盖它:http : //docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html
大家有没有遇到过类似的问题,如果有,你们是怎么解决的?
我找不到类似的问题,所以在这里:Moment.js在进行格式化时似乎并不理解其他语言而不是英语.
带有locales的Moment.js在资产中,当我尝试以下时:
moment('1. März 2014').format('LLLL');
"Invalid date"
Run Code Online (Sandbox Code Playgroud)
另一方面,这工作:
moment('1. March 2014').format('LLLL');
"Samstag, 1. März 2014 00:00 Uhr"
Run Code Online (Sandbox Code Playgroud)
我已经有了一些解决方法,但要让它干净是很棒的.什么是U diubg错误的任何想法?
我使用chrome 38.0.2125.111和moment.js 2.8.3.
如果您需要有关该问题的更多信息,请告诉我.
编辑
看起来只有几个月是有问题的.这非常有效:
moment('1. Januar 2014').format('LLLL');
"Mittwoch, 1. Januar 2014 00:00
Run Code Online (Sandbox Code Playgroud)
我觉得它可能像März中的ä一样特殊.但这不会起作用:
moment('1. Dezember 2014').format('LLLL');
"Invalid date"
Run Code Online (Sandbox Code Playgroud) symfony ×2
aws-lambda ×1
java ×1
javascript ×1
momentjs ×1
phpunit ×1
testing ×1
timestamp ×1
twig ×1