sebastianbergmann / dbunit

DbUnit port for PHP/PHPUnit.
https://phpunit.de/
Other
225 stars 186 forks source link

trait not found #202

Closed Amar-45 closed 6 years ago

Amar-45 commented 6 years ago

trait phpunit/dbunit/testcasetrait not found while connecting dbunit with phpunit

sebastianbergmann commented 6 years ago

Thank you for your report.

Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.

Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.

Amar-45 commented 6 years ago

`
use PHPUnit\Framework\TestCase; use PHPUnit\DbUnit\TestCaseTrait;

abstract class SampleTest extends TestCase { use TestCaseTrait;

// only instantiate pdo once for test clean-up/fixture load
static private $pdo = null;

// only instantiate PHPUnit_Extensions_Database_DB_IDatabaseConnection once per test
private $conn = null;

public function getConnection()
{
    if ($this->conn === null) {
        if (self::$pdo == null) {
            self::$pdo = new PDO($GLOBALS['DB_DSN'], $GLOBALS['DB_USER'], $GLOBALS['DB_PASSWD']);
        }
        $this->conn = $this->createDefaultDBConnection(self::$pdo, $GLOBALS['DB_DBNAME']);
    }

}

public function getDataSet()
{
    return $this->createMySQLXMLDataSet('D:/xampp/htdocs/UnitTest/myFlatXmlFixture.xml');
}

} `

Amar-45 commented 6 years ago

Iam using Php Version : 7.0 and phpunit version 6.4

sebastianbergmann commented 6 years ago

How did you install PHPUnit? How did you install DbUnit?

Amar-45 commented 6 years ago

by using composer require phpunit/phpunit and composer require phpunit/dbunit

Amar-45 commented 6 years ago

iam stuck while connecting with db

peter279k commented 6 years ago

Hi @Amar-45, I don't have this problem. And here is my repo that you can refer.

I use the Same PHP version and package version that are for your specific version. Check out the MyDbTest.php in tests folder to see more details about this.

Thanks.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions.