Monday, April 14, 2014

Re: 3.0 - Fixtures ?

<?php  namespace MyPlugin\Test\Fixture;    use Cake\TestSuite\Fixture\TestFixture;    /**   * AcoFixture   *   */  class MyTableFixture extends TestFixture {    /**   * Fields   *   * @var array   */  	public $fields = [  		'id' => ['type' => 'integer', 'length' => 10, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null],  		'parent_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => false, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],  		'model' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null],  		'foreign_key' => ['type' => 'integer', 'length' => 10, 'unsigned' => false, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],  		'alias' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null],  		'lft' => ['type' => 'integer', 'length' => 10, 'unsigned' => false, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],  		'rght' => ['type' => 'integer', 'length' => 10, 'unsigned' => false, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],  		'_indexes' => [  			'parent_id' => ['type' => 'index', 'columns' => ['parent_id'], 'length' => []],  			'foreign_key' => ['type' => 'index', 'columns' => ['foreign_key'], 'length' => []],  			'alias' => ['type' => 'index', 'columns' => ['alias'], 'length' => []],  			'model' => ['type' => 'index', 'columns' => ['model'], 'length' => []],  			'lft' => ['type' => 'index', 'columns' => ['lft'], 'length' => []],  			'rght' => ['type' => 'index', 'columns' => ['rght'], 'length' => []],  		],  		'_constraints' => [  			'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],  		],  	];    /**   * Records   *   * @var array   */  	public $records = [  		[  			'id' => 1,  			'parent_id' => 1,  			'model' => 'Lorem ipsum dolor sit amet',  			'foreign_key' => 1,  			'alias' => 'Lorem ipsum dolor sit amet',  			'lft' => 1,  			'rght' => 1  		],  	];    }  

On 14 Apr 2014, at 11:54, José Lorenzo <jose.zap@gmail.com> wrote:

How does the fixture look like?

On Monday, April 14, 2014 11:46:15 AM UTC+2, Thomas von Hassel wrote:
I’m using this to import them:

public $fixtures = [
        'plugin.plugin_name.my_table'
];


and the fixture class is in

Plugin/PluginName/Test/Fixture/MyTableFixture.php

but gives me this error when trying run the test:

Notice Error: Undefined offset: 1 in [/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureManager.php, line 143]



On 14 Apr 2014, at 11:39, José Lorenzo <jose.zap@gmail.com> wrote:

> No, they should work fine. What is the problem you are getting and how are you importing them?
>
> On Sunday, April 13, 2014 5:38:24 PM UTC+2, Thomas von Hassel wrote:
> am i right to assume that fixtures, in particular in plugins, are not working in 3.x yet ?
>
> /thomas
>
>
> --
> 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 cake-php+unsubscribe@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.


--
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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: