PDA

View Full Version : ارور phpunit



saeed51100
جمعه 01 مرداد 1400, 22:12 عصر
سلام
موقع اجرای تست phpunit ارور :
Failed to open stream: No such file ordirectory
را دریافت نمودم و چند روز است که در گوگل هم راه حلی پیدا نکردم :









// src/Getchar.php

function getchar($c){
return chr($c);}

echo getchar(75);

// **********************************************
// tests/GetcharTest.php

use PHPUnit\Framework\TestCase;

class GetcharTest extends TestCase{

public function setUp(): void
{
$this->assertTrue(true);
}
public function testSampleTests()
{
include "../src/Getchar.php";
$this->assertEquals('A', getChar(65));
}
}
// ************************************************** *************
// recived error after run ./vendor/bin/phpunit in command line:

PHPUnit 9.5.7 by Sebastian Bergmann and contributors.
Runtime: PHP 8.0.8Configuration: /var/www/phptest.com/phpunit.xml
E 1 / 1 (100%)
Time: 00:00.016, Memory: 6.00 MB
There was 1 error:
1) GetcharTest::testSampleTestsinclude(../src/Getchar.php): Failed to open stream: No such file or directory
/var/www/phptest.com/tests/GetcharTest.php:18/var/www/phptest.com/tests/GetcharTest.php:18
ERRORS!Tests: 1, Assertions: 1, Errors: 1.