vendredi 26 janvier 2018

How do I set my paths when running a PHP unit test?

I'm running PHP 7.1.7 on Mac High Sierra. I want to run a test (unit test?) from a file in my tests directory at the root of my project folder. The beginning of the test looks like

<?php

namespace BitWasp\Stratum\Tests;

use BitWasp\Stratum\Client;
use BitWasp\Stratum\Request\RequestFactory;
use React\EventLoop\StreamSelectLoop;
use React\Promise\Deferred;
use React\Socket\Server;
use React\SocketClient\TcpConnector;
use React\Stream\Stream;

class ClientTest extends AbstractStratumTest
{
    public function testConnect()
    {
    ...

To run the test, I'm running ...

localhost:tests davea$ php ClientTest.php

Fatal error: Class 'BitWasp\Stratum\Tests\AbstractStratumTest' not found in /Users/davea/Documents/workspace/stratum-php-master/tests/ClientTest.php on line 13

What is odd about teh error is that the missing class the program is complaining about is in the same directory as the test itself

localhost:tests davea$ ls
AbstractStratumTest.php  Api  ClientTest.php  ConnectionTest.php  Notification  Request

What's the right way to tell php where my other files are so I can run my test?

Aucun commentaire:

Enregistrer un commentaire