Cakephp Unit testing:using fixtures in components

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Cakephp Unit testing:using fixtures in components

Iam writing test cases for one component ,need to use fixtures in compoment.
my code is
Class SampleComponentTest extends TestCase
    public $component = null;
    public $controller = null;
    public $fixtures = ['app.cities','plugin.sampleplugin.states'];
    public function setUp()
        $request = new Request();
        $response = new Response();
        $this->controller = $this->getMock(
            [$request, $response]
        $registry = new ComponentRegistry($this->controller);
        $this->component = new SampleComponent($registry);
And i need to use two fixtures ,one is from app and another is from plugin.
when i run the code i got followign exception
"Exception: Referenced fixture class "SamplePlugin\Test\Fixture\StatesFixture" not found. Fixture "plugin.sampleplugin.states" was referenced in test case "App\Test\TestCase\Controller\Component\SampleComponentTest". in [D:\Projects\xampp\htdocs\testapp\vendor\
cakephp\cakephp\src\TestSuite\Fixture\FixtureManager.php, line 213]".

please provide the solutions to that how to use fixtures in component with sample code/
1)$this->component is mock object or direct object>
2)what is second parameter of getMock() method(if i provide empty it giving the error,above i replaced with empty)

Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.