I want to know how to unit test classes. When i attempt to create test case and use any class. This code below doesn't work because my class wasn't found. But that's how other plugins done.
But when i do this code, it works.
Is there a way to make a testing just like the bundled plugins?
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 1 like
- Aerial@aerial
Aerial - 0 likes
<?php namespace Elgg\HeyloSP;
use Elgg\Plugins\PluginTesting;
class SampleClassTest extends \Elgg\UnitTestCase { use PluginTesting;
public function up() {
}
public function down() {
}
public function testHello() { $this->startPlugin(); $this->assertEquals('Hello', SampleClass::hello()); } }
You must log in to post replies.Look at this.
BTW, TestCaseUnitTest is a legacy class.
Thanks for the help! I find it funny that it didn't work my classes when i dont implement PluginTest trait and call
function to work on the classes.
This is the result of my new testing unit code