CakeDC / utils

Utils Plugin for CakePHP

Home Page:http://cakedc.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

InheritableBehaviour CTI ids do not work correctly

ezequielp opened this issue · comments

The following test fails on my side:

public function testClassTableCreateCount() {
    $initial_count = $this->Asset->find('count');

    for ($i=0; $i<10; $i++) {
        $this->Image->create(array(
            'title' => 'BSD logo',
            'description' => 'Daemon powers',
            'file_name' => 'bsd.bmp',
            'file_size' => '653445',
            'content_type' => 'image/bitmap'));
        $this->Image->save();           
    }

    $final_count = $this->Asset->find('count');
    $this->assertEqual($final_count-$initial_count, 10);
}

The problem is that when creating Image, the fields override all Link data.

Also, notice the strange way the fixture was created:

AssetFixture:
array('id' => 1, 'title'=> 'soccuer image', 'description'=> 'amazing shot...'),
array('id' => 2, 'title'=> 'animal image', 'description'=> 'very disturbing'),

    array('id' => 11, 'title'=> 'home page link', 'description' => 'link back to home page'),
    array('id' => 12, 'title'=> 'google', 'description' => 'Google is the search engine'),

ImageFixture:
array('id' => 1, 'file_name'=> 'soccer_worldcup.jpg', 'file_size' =>' 53422', 'content_type' => 'image/jpeg'),
array('id' => 2, 'file_name'=> 'dog.png', 'file_size'=>'431234', 'content_type'=>'image/png'),
LinkFixture:
array('id' => 11, 'url'=> 'http://cakephp.org'),
array('id' => 12, 'url'=> 'http://google.com'),

This is why I had to save 10 Images to be able to show this bug.

Ok, the following fixes this issue

https://gist.github.com/4360618

Fixed in 541a51c thank you!