Here is my Test Class;
<?php
namespace stats\Test;
use stats\Baseball;
class BaseballTest extends \PHPUnit_Framework_TestCase
{
public function setUp() {
$this->instance = new Baseball();
}
public function tearDown() {
unset($this->instance);
}
public function testOps() {
$obp = .363;
$slg = .469;
$ops = $this->instance->calc_ops($obp, $slg); //line 23
$expectedops = $obp + $slg;
$this->assertEquals($expectedops, $ops);
}
}
And this is my Baseball Class;
<?php
namespace stats;
class Baseball
{
private function calc_ops($slg,$obp)
{
return $slg + $obp;
}
}
And I keep getting this error when I run my tests;
Fatal error: Call to private method stats\Baseball::calc_ops() from context 'stats\Test\BaseballTest' in /media/sf_sandbox/phpunit/stats/Test/BaseballTest.php on line 23
This is only a tutorial I am following.. But it's not working so it's frustrating because I am following it exactly.
Aucun commentaire:
Enregistrer un commentaire