小编Nik*_*kos的帖子

Assetic无法找到文件

我想在一个twig模板中链接一个css文件(它存在于一个包中):

{% stylesheets 
    '@AcmeFooBundle/Resources/public/css/bootstrap.min.css' 
%}
    <link href="{{ asset_url }}" rel="stylesheet"/>
{% endstylesheets %}
Run Code Online (Sandbox Code Playgroud)

我得到的第一条错误消息是:

您必须将AcmeFooBundle添加到assetic.bundle配置中...

这是配置:

# Assetic Configuration
assetic:
    debug:          %kernel.debug%
    use_controller: false
    bundles:        []
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        #closure:
        #    jar: %kernel.root_dir%/Resources/java/compiler.jar
        #yui_css:
        #    jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
Run Code Online (Sandbox Code Playgroud)

然后我尝试在bundle指令中添加AcmeFooBundle,但后来我收到一个错误:

无法找到文件....

我无法理解我在这里做错了什么......

在控制台中转储资产配置的默认配置(使用php app/console config:dump-reference assetic)我可以看到在bundle指令中列出的AcmeFooBundle包...

symfony assetic

13
推荐指数
2
解决办法
2万
查看次数

API测试+事务回滚

我有一个这样的测试:

@Test
@Transactional
public void when_EnteredRegisteredProductionOrder_and_RegisteredStaffSignature_then_201_and_ProductionOrderRegistered() {
    //language=JSON
    String startProductionOrder = "{\n" +
            "  \"productionOrder\": \"1700281\",\n" +
            "  \"staffCodeSignature\": \"00000425\"\n" +
            "}";

    given()
            .body(startProductionOrder)
            .accept(ContentType.JSON)
            .contentType(ContentType.JSON)
            .when()
            .post(commandPath)
            .then().statusCode(201);


    ProductionOrder po = productionOrderRepo.findOneByCode("1700281");
    assertThat(po.getCode(), is("1700281"));
}
Run Code Online (Sandbox Code Playgroud)

我的目的是使用 resassured 从头到尾测试 REST API。正如您可以想象的那样,从控制器开始的每个命令都用@Transactional 进行注释。问题是测试不会自动回滚。调试日志显示(我删除了很多部分,因为发布太长):

DEBUG 14120 --- [           main] tractDirtiesContextTestExecutionListener : Before test method: context [DefaultTestContext@1dd02175 testClass = ProductionOrderStartLT, testInstance = com.demo.logbook.commandValidationLT.ProductionOrderStartLT@25359ed8, testMethod = when_EnteredRegisteredProductionOrder_and_RegisteredStaffSignature_then_201_and_ProductionOrderRegistered@ProductionOrderStartLT, testExcep
DEBUG 14120 --- [           main] t.a.AnnotationTransactionAttributeSource : Adding transactional method 'com.demo.logbook.commandValidationLT.ProductionOrderStartLT.when_EnteredRegisteredProductionOrder_and_RegisteredStaffSignature_then_201_and_ProductionOrderRegistered' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
DEBUG …
Run Code Online (Sandbox Code Playgroud)

java spring integration-testing spring-transactions spring-boot

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

带符号的32位二进制的负整数

>>> a = -2147458560
>>> bin(a)
'-0b1111111111111111001111000000000'
Run Code Online (Sandbox Code Playgroud)

我的意图是操作a为32位带符号的二进制文件并返回它.正确的转换-2147458560将是'0b10000000000000000110001000000000'; 我怎么能实现这一目标?

python binary python-2.7

4
推荐指数
1
解决办法
4864
查看次数

React Native“全局”变量Intellij未定义

这是 app.tsx

{global.HermesInternal == null ? null : (
    <View style={styles.engine}>
    <Text style={styles.footer}>Engine: Hermes</Text>
    </View>
)}
Run Code Online (Sandbox Code Playgroud)

这是 package.json

  "devDependencies": {
    "@babel/core": "^7.5.0",
    "@babel/runtime": "^7.5.0",
    "@react-native-community/eslint-config": "^0.0.3",
    "@types/jest": "^24.0.15",
    "@types/react": "^16.9.2",
    "@types/react-native": "^0.60.15",
    "@types/react-test-renderer": "^16.8.2",
    "babel-jest": "^24.1.0",
    "jest": "^24.1.0",
    "metro-react-native-babel-preset": "^0.54.1",
    "react-native-typescript-transformer": "^1.2.13",
    "react-test-renderer": "16.8.6",
    "typescript": "^3.6.3"
  },
Run Code Online (Sandbox Code Playgroud)

Intellij收到一条类型错误消息“Unresolved variable of type global”,但应用程序运行成功。我尝试添加@types/node,然后抛出关于HermesInternal不属于全局对象的类型错误。


仅供参考@types/react-native/index.d.ts,声明如下:

declare global {
    ...
    const HermesInternal: null | {};
}
Run Code Online (Sandbox Code Playgroud)

typescript react-native

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