Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

c3.php throwing PHP Warnings with Vagrant

Đang mở
#32 7 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
php
Lĩnh vực
testing-qa

Hướng nghiên cứu

Tái hiện lỗi bằng lệnh Codeception được nêu bên trong Vagrant và kiểm tra tests/_output/c3tmp. Bắt đầu với các dòng 184-194 và 318-321 trong c3.php, sau đó so sánh các cảnh báo về tệp và khóa được báo cáo với quyền của thư mục. Hoàn tất khi các bài kiểm thử chức năng và các assertion JSON hoàn thành mà không có những cảnh báo này hoặc lỗi nghiêm trọng xảy ra sau đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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/*
Ngôn ngữ chính
PHP
Star
73
Fork
46
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Codeception/c3

Tất cả issue của Codeception/c3

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.