saeed51100
چهارشنبه 30 تیر 1400, 15:05 عصر
سلام
من با تست واحد برای کدهای procedural یا رویه ای مشکل دارم.
با استفاده از لینک زیر ، تست ها را به شرح زیر نوشتم ، اما هنگام اجرای تست در لوکال خطاهای زیر دریافت کردم. مشکل از کجاست؟
https://stackoverflow.com/questions/899390/how-do-i-write-unit-tests-in-php-with-a-procedural-codebase
// *********************************************
// src/Getchar.php
function getchar($c){
return chr($c);
}
echo getchar(75);
// ************************************************** **********
// tests/GetcharTest.php
use PHPUnit\Framework\TestCase;
class GetcharTest extends TestCase
{
private $Getchar;
public function setUp(): void
{
$this->Getchar->getChar();
}
public function testSampleTests()
{
$this->assertEquals('A', getChar(65));
}
}
من با تست واحد برای کدهای procedural یا رویه ای مشکل دارم.
با استفاده از لینک زیر ، تست ها را به شرح زیر نوشتم ، اما هنگام اجرای تست در لوکال خطاهای زیر دریافت کردم. مشکل از کجاست؟
https://stackoverflow.com/questions/899390/how-do-i-write-unit-tests-in-php-with-a-procedural-codebase
// *********************************************
// src/Getchar.php
function getchar($c){
return chr($c);
}
echo getchar(75);
// ************************************************** **********
// tests/GetcharTest.php
use PHPUnit\Framework\TestCase;
class GetcharTest extends TestCase
{
private $Getchar;
public function setUp(): void
{
$this->Getchar->getChar();
}
public function testSampleTests()
{
$this->assertEquals('A', getChar(65));
}
}