Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

c3.php throwing PHP Warnings with Vagrant

Abierto
#32 7 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
php
Área
testing-qa

Línea de trabajo

Reproduce el fallo con el comando de Codeception indicado dentro de Vagrant e inspecciona tests/_output/c3tmp. Empieza por las líneas 184-194 y 318-321 de c3.php y, después, compara las advertencias notificadas sobre archivos y bloqueos con los permisos del directorio. La tarea está terminada cuando las pruebas funcionales y las aserciones JSON se completan sin estas advertencias ni el error fatal posterior.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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/*
Lenguaje dominante
PHP
Estrellas
73
Forks
46
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Codeception/c3

Todos los issues de Codeception/c3

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.