lundi 26 février 2018

Method not found - PHPUnit Confusion

Code

class Rechner {

    public function add($a, $b){
        return $a + $b;
    }

My TestCase

class RechnerTest extends PHPUnit\Framework\TestCase
{

    public $calculator;

    protected function setUp ()
    {
        $this->calculator = new Rechner();
    }

    protected function tearDown ()
    {
        $this->calculator = NULL;
    }

    public function testAdd ()
    {


        $result = $this->calculator->add(1, 2);
        $this->assertEquals(3, $result);
    }

}

Error Output

Error: Class 'Rechner' not found

Composer.json file

{
  "autoload":{
    "psr-0" :{
      "":"src"
    },
    "classmap": [
      "tests"
    ]
  },
  "require": {
    "phpunit/phpunit": "^6.5",
    "authorizenet/authorizenet": "^1.9"
  }
}

My Problem

I am trying to figure out why the Method is not found.

If i try to require __DIR__ the 'Recher.php' does not show up, only the test case...and thats the one i don't need. Im am not sure what to do.

Aucun commentaire:

Enregistrer un commentaire