I'm doing a unit testing with my CVRClient
file using the code below.
//CvrapiTest.php
<?php
namespace Drupal\cvr\test\Cvrapi;
use PHPUnit_Framework_TestCase;
use cvr\src\Cvrapi\CVRClient;
class CvrapiTest extends PHPUnit_Framework_TestCase {
public function testSearchOnlyVAT()
{
$result = \Cvrapi\CVRClient::request('29910251', 'dk', 'vat', 'Unit Testing');
$this->assertTrue(property_exists($result, 'vat'));
$this->assertTrue((int)$result->vat === 29910251);
}
I have a CVRClient
class under cvr/src/Cvrapi
folder that queries data from an api.
I know that phpunit
command is working fine but I'm getting the error below.
Fatal error: Class 'cvr\src\Cvrapi\CVRClient' not found in /Applications/MAMP/htdocs/query/modules/custom/cvr/test/Cvrapi/CvrapiTest.php on line 17
NOTE: It's the \Cvrapi\CVRClient::
that causes the error. If I remove this line, I need to have a code to assign values to $result
.