小编gre*_*reg的帖子

symfony功能测试webtestcase不起作用

我尝试为我的应用程序编写功能测试但是我收到以下错误:

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

testing phpunit symfony

12
推荐指数
1
解决办法
4987
查看次数

如何将API网关与SQS集成

就像在标题中一样.我尝试使用云形成将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)

amazon-web-services aws-cloudformation aws-api-gateway

11
推荐指数
2
解决办法
7083
查看次数

Symfony2,如果控制器有一个构造函数,如何在树枝模板中呈现控制器的动作

从官方文档(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)

dependency-injection symfony twig

5
推荐指数
2
解决办法
2608
查看次数

AWS Lambda Java如何读取属性文件

我尝试将属性从文件加载到 Properties 类中。我希望这个解决方案能够工作: How to load property file from classpath in AWS lambda java

\n\n

我有一个带有很少静态方法的类,我想将其用作配置持有者。里面有这么一行

\n\n
final InputStream inputStream = \nConfig.class.getClass().getResourceAsStream("/application-main.properties");\n
Run Code Online (Sandbox Code Playgroud)\n\n

并且它总是返回 null。我下载了 Lambda 使用的 zip 包,该文件位于根目录中。尽管如此,还是不​​行。

\n\n

有人有类似的问题吗?

\n\n

编辑:\n配置文件在这里:

\n\n
project\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\n
Run 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)

java amazon-web-services aws-lambda

5
推荐指数
1
解决办法
1万
查看次数

您可以使用 Cloud Formation 创建使用计划吗?

就像标题一样。我只能使用 Cloud Formation 在 AWS 上部署东西。现在我尝试使用 API 密钥保护我的 API 网关,看起来我需要一个使用计划。此处的文档似乎并未涵盖它:http : //docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html

大家有没有遇到过类似的问题,如果有,你们是怎么解决的?

amazon-web-services aws-cloudformation

3
推荐指数
1
解决办法
2250
查看次数

moment.js日期到时间戳国际化(德语)

我找不到类似的问题,所以在这里: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)

javascript timestamp internationalization momentjs

2
推荐指数
1
解决办法
2442
查看次数