c3.php throwing PHP Warnings with Vagrant

オープン
#32 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php
領域
testing-qa

調査の方向性

Vagrant 内で指定された Codeception コマンドを使って失敗を再現し、tests/_output/c3tmp を調べてください。まず c3.php の 184-194 行目と 318-321 行目から始め、その後、報告されたファイルおよびロックに関する警告をディレクトリの権限と比較してください。機能テストと JSON アサーションが、これらの警告や後続の fatal error なしに完了すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Description

I seem to receiving an error when trying to generate code coverage for functional tests inside Vagrant. The tests run and the code coverage generates fine but some test fail (namely any check on the response being valid JSON) due to PHP Warnings being thrown by the c3.php file.

Steps

When ssh'd into vagrant, I run this command:

./vendor/bin/codecept run functional --coverage-html=blah tests/functional/Company/Product/CategoriesCest.php

All 3 tests fail when trying to assert $I->seeResponseIsJson();. When taking a look at the failure report generate in tests/_output/tests.Company.Product.CategoriesCest.orderCategoriesDesc.fail.html I see the following error:

Warning: file_put_contents(/var/www/phpapps/api.testurl.test/tests/_output/c3tmp/codecoverage.serialized): failed to open stream: Permission denied in /var/www/phpapps/api.testurl.test/c3.php on line 321

At line 321, c3.php is trying to execute:

https://github.com/Codeception/c3/blob/f08f20b0b6191f0c58be022c6f20d5b1cdc1004c/c3.php#L320-L322

which it can't complete because the permissions for c3tmp directory are as follows:

drwxr-xr-x 1 vagrant vagrant     68 Aug 10 08:55 c3tmp/

I'm puzzled as to why codeception wouldn't have permissions to write codecoverage.serialized in c3tmp/ when it has created the directory itself... Furthermore, applying full read-write permissions to the c3tmp/ via:

chmod -R 777 tests/_output/c3tmp/

results in even more PHP Warnings being generated seemingly from the same type of issue i.e incorrect file permissions, read-write lock etc. I've detailed these issues below:

Warning: fopen(/var/www/phpapps/api.testurl.test/tests/_output/c3tmp/codecoverage.serialized): failed to open stream: Permission denied in /var/www/phpapps/api.testurl.test/c3.php on line 184

Warning: flock() expects parameter 1 to be resource, boolean given in /var/www/phpapps/api.testurl.test/c3.php on line 185

Notice: Undefined variable: phpCoverage in /var/www/phpapps/api.testurl.test/c3.php on line 194

Fatal error: Call to a member function merge() on a non-object in /var/www/phpapps/api.testurl.test/c3.php on line 318

Additional Information

  • Vagrant: Vagrant 1.9.2

  • PHP: PHP 5.5.9-1ubuntu4.20 (cli)

  • functional.suite.dist.yml

class_name: FunctionalTester
error_level: -1
coverage:
    enabled: true
modules:
    enabled: [PhpBrowser, REST, Asserts, FunctionalHelper]
    config:
        PhpBrowser:
            url: http://api.testurl.test/
        REST:
            url: http://api.testurl.test/

  • codeception.yml
actor: Tester
paths:
    tests: tests
    log: tests/_output
    data: tests/_data
    helpers: tests/_support
settings:
    bootstrap: _bootstrap.php
    colors: true
    memory_limit: 1024M
coverage:
    enabled: true
    whitelist:
        include:
            - src/*
            - public/*
        exclude:
            - src/Company/*/apidoc.json
            - src/Company/*/apiDocVersioning/*
主要言語
PHP
スター
73
フォーク
46
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Codeception/c3 のほかの issue

Codeception/c3 の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。