Codeception / Codeception/AspectMock

Aspect Mock broken by comments

Ouverte
#70 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
PHP
Étoiles
784
Forks
132
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
php
Domaine
testing
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.