Stub::update not working properly when changing method return value
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 48/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- php
- Domaine
- testing-qa
Piste de recherche
Localisez le point d’entrée Stub::update dans le package Codeception Stub et reproduisez l’exemple PHP fourni. Comparez les résultats de la méthode et de l’attribut mis à jour, puis ajoutez des tests couvrant le comportement démontré afin que la méthode retourne C après la mise à jour, tandis que l’attribut continue de le faire.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Hello. The following snippet demonstrates the problem I'm having. Perhaps it's a bug?
class SomeCest{
public function stubUpdate(UnitTester $I) {
$object = new GenericClass();
$actualGetValue1= $object->getValue();
$actualAttr1= $object->attr;
$Stub = Stub::make($object, [
'getValue' => 'B',
'attr' => 'B'
]);
$actualGetValue2 = $Stub->getValue();
$actualAttr2= $Stub->attr;
Stub::update($Stub, [
'getValue' => "C",
'attr' => "C"
]);
$actualGetValue3 = $Stub->getValue();
$actualAttr3= $Stub->attr;
$I->assertEquals('A', $actualAttr1); // ok
$I->assertEquals('A', $actualGetValue1); // ok
$I->assertEquals('B', $actualAttr2); // ok
$I->assertEquals('B', $actualGetValue2); // ok
$I->assertEquals("C", $actualAttr3); // ok
$I->assertEquals("C", $actualGetValue3); // => fails, uses previous value (B)
}
}
class GenericClass {
public $attr = 'A';
public function getValue() {
return 'A';
}
}
composer show:
behat/gherkin v4.5.1 Gherkin DSL parser for PHP 5.3
brainmaestro/composer-git-hooks v2.4.3 Easily manage git hooks in your composer config
codeception/aspect-mock 3.0.0 Experimental Mocking Framework powered by Aspects
codeception/codeception 2.4.2 BDD-style testing framework
codeception/phpunit-wrapper 7.1.3 PHPUnit classes used by Codeception
codeception/stub 2.0.1 Flexible Stub wrapper for PHPUnit's Mock Builder
doctrine/annotations v1.6.0 Docblock Annotations Parser
doctrine/cache v1.7.1 Caching library offering an object-oriented API for many cache backends
doctrine/instantiator 1.1.0 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
fabpot/goutte v3.2.2 A simple PHP Web Scraper
facebook/webdriver 1.6.0 A PHP client for Selenium WebDriver
goaop/framework 2.2.0 Framework for aspect-oriented programming in PHP.
goaop/parser-reflection 1.4.1 Provides reflection information, based on raw source
guzzlehttp/guzzle 6.3.3 Guzzle is a PHP HTTP client library
guzzlehttp/promises v1.3.1 Guzzle promises library
guzzlehttp/psr7 1.4.2 PSR-7 message implementation that also provides common utility methods
jakubledl/dissect v1.0.1 Lexing and parsing in pure PHP
mpdf/mpdf v7.0.3 A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support
myclabs/deep-copy 1.8.0 Create deep copies (clones) of your objects
nikic/php-parser v3.1.5 A PHP parser written in PHP
paragonie/random_compat v2.0.12 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phar-io/manifest 1.0.1 Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version 1.0.1 Library for handling version information and constraints
phpdocumentor/reflection-common 1.0.1 Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock 4.3.0 With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
phpdocumentor/type-resolver 0.4.0
phpspec/prophecy 1.7.6 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 6.0.5 Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator 1.4.5 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 2.0.0 Utility class for timing
phpunit/php-token-stream 3.0.0 Wrapper around PHP's tokenizer extension.
phpunit/phpunit 7.1.5 The PHP Unit Testing framework.
phpunit/phpunit-mock-objects 6.1.2 Mock Object library for PHPUnit
psr/http-message 1.0.1 Common interface for HTTP messages
psr/log 1.0.2 Common interface for logging libraries
sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or method a line of code belongs to
sebastian/comparator 3.0.0 Provides the functionality to compare PHP values for equality
sebastian/diff 3.0.0 Diff implementation
sebastian/environment 3.1.0 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 3.1.0 Provides the functionality to export PHP variables for visualization
sebastian/global-state 2.0.0 Snapshotting of global state
sebastian/object-enumerator 3.0.3 Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector 1.1.1 Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context 3.0.0 Provides functionality to recursively process PHP variables
sebastian/resource-operations 1.0.0 Provides a list of PHP built-in functions that operate on resources
sebastian/version 2.0.1 Library that helps with managing the version number of Git-hosted PHP projects
setasign/fpdf 1.8.1 FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.
setasign/fpdi 1.6.2 FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no...
symfony/browser-kit v4.1.0 Symfony BrowserKit Component
symfony/console v4.1.0 Symfony Console Component
symfony/css-selector v4.1.0 Symfony CssSelector Component
symfony/dom-crawler v4.1.0 Symfony DomCrawler Component
symfony/event-dispatcher v3.4.9 Symfony EventDispatcher Component
symfony/finder v4.1.0 Symfony Finder Component
symfony/polyfill-ctype v1.8.0 Symfony polyfill for ctype functions
symfony/polyfill-mbstring v1.8.0 Symfony polyfill for the Mbstring extension
symfony/process v4.1.0 Symfony Process Component
symfony/yaml v4.1.0 Symfony Yaml Component
theseer/tokenizer 1.1.0 A small library for converting tokenized PHP source code into XML and potentially other formats
trf4/infra dev-desenv b05d89f Framework PHP desenvolvido pelo TRF4.
webmozart/assert 1.3.0 Assertions to validate method input/output with nice error messages.
- Langage dominant
- PHP
- Étoiles
- 301
- Forks
- 19
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de Codeception/Stub
-
makeEmpty/make silently loses property values for PHP 8.4+ hooked propertiesPeut-être pris @petrdobr l’a pris il y a 68 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 68/100
Codeception/Stub#61 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 42/100
Codeception/Stub#45 · 1 commentaire ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
Codeception/Stub#36 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
Codeception/Stub#30 · 1 réaction ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 48/100
Codeception/Stub#31 · 3 commentaires ·
Toutes les issues de Codeception/Stub
Issues similaires
-
sync-en
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
sync-en
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 4 jours
-
Combination form: image thumbnails collapse to 0×0 when a stylesheet sets `img { max-width: 100% }`Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
PrestaShop/PrestaShop#43200 ·
Les mainteneurs répondent en général sous 1 jour
-
[Type] Enhancement Help Wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
codeigniter4/CodeIgniter4#10616 ·
Les mainteneurs répondent en général sous 1 jour