Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Stub::update not working properly when changing method return value

オープン
#7 コメント 0 件 リアクション 5 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php
領域
testing-qa

調査の方向性

Codeception Stub パッケージ内の Stub::update エントリポイントを特定し、提供された PHP の例を再現してください。更新されたメソッドと属性の結果を比較し、示された動作をカバーするテストを追加して、更新後もメソッドが C を返し、属性も引き続き C を返すようにしてください。

索引モデルが issue の本文から書いたものです。

説明

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.


主要言語
PHP
スター
301
フォーク
19
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Codeception/Stub のほかの issue

Codeception/Stub の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。