I'm trying to create a test using Phpunit and mocking with Prophecy but I'm getting MethodNotFoundException. This is my code:
<?php
namespace Drupal\forum_innovation\Tests;
use Prophecy;
/**
* Test the ForumCounter Class.
* @coversDefaultClass \Drupal\forum_innovation\Forum
* @group utility
*/
class ForumCounterTest extends \PHPUnit_Framework_TestCase {
/**
* @covers::setForumCounter
*/
public function testSetForumCounter() {
$prophet = new Prophecy\Prophet;
$set_counter = $prophet->prophesize('Drupal\forum_innovation\Forum\ForumCounter');
$set_counter->setForumCounter(83, 3024)->willReturn(TRUE);
$stub = $set_counter->reveal();
}
}
I'm executing the test from the command line and I'm getting this error:
This is the class and methods I want to test:
<?php
namespace Drupal\forum_innovation\Forum;
class ForumCounter implements ForumInterface {
public static function setForumCounter($forum, $uid) {
$counterState = db_update('forum_counter_states')
->fields(array(
'state' => 'read',
))
->condition('uid', $uid)
->condition('tid', $forum)
->execute();
return $counterState;
}
}
I don't know what is wrong with test, so, any help will be appreciate it. Thanks.