Codeception / Codeception/AspectMock

Aspect Mock broken by comments

Abierto
#70 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
PHP
Estrellas
784
Forks
132
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Method declaration such as `function myMethod( ) /* {{{ */ {` cannot be mocked with Aspect Mock.

On line 98 current code gets the first open bracket { amd inserts the injection code after it
`$pos = strpos($dataArray[$i], '{');`

https://github.com/Codeception/AspectMock/blob/master/src/AspectMock/Intercept/BeforeMockTransformer.php#L98

This turns the method declaration to
`function myMethod( ) /* { if (($__am_res = __amock_before($this, __CLASS__, __FUNCTION__, array(), false)) !== __AM_CON
TINUE__) return $__am_res; {{ */ {
`

Which basically commented all Aspect Mock injection code.

Guía de contribución

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

Línea de trabajo

Start in src/AspectMock/Intercept/BeforeMockTransformer.php at line 98 and inspect how the first opening brace is located in a method declaration. Reproduce the issue with a declaration containing a comment before the brace; done means the generated comment no longer comments out the Aspect Mock injection code.

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

Evaluación

Stack tecnológico
php
Área
testing
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.