Hi,
I still feel very much like a noob when writing tests, so patience
please :)

I have a Test for a Model where the fixture contains collation-
sensitive data. Now I can't see any change in my tests when I
deliberately alter the schema to get different results back. It is
like my fixture is cached outside of the cache dir or some such
nonsense.

I am clearly missing a key piece of this puzzle :)

My fixture:
class ContactTestFixture extends CakeTestFixture {
    var $name = 'ContactTest';
    var $import = array('table' => 'contacts', 'connection' =>
'default');

var $records = array(
        array('id' => 1, 'uid' => 'user1', 'verified' => '0',
'blocked' => '0', 'created' => '2008-05-12 20:38:36', 'modified' =>
'2008-05-12 20:38:36'),
        array('id' => 2, 'uid' => 'user2', 'verified' => '1',
'blocked' => '0', 'created' => '2008-05-13 10:05:25', 'modified' =>
'2008-05-13 10:08:12'),
        array('id' => 3, 'uid' => 'user3', 'verified' => '1',
'blocked' => '0', 'created' => '2008-05-13 10:05:25', 'modified' =>
'2008-05-13 10:08:12'),
        array('id' => 4, 'uid' => 'user4', 'verified' => '0',
'blocked' => '0', 'created' => '2008-05-13 10:05:25', 'modified' =>
'2008-05-13 10:08:12'),
        array('id' => 5, 'uid' => 'user_a','verified' => '1',
'blocked' => '0', 'created' => '2008-05-13 10:05:25', 'modified' =>
'2008-05-13 10:08:12'),
        array('id' => 6, 'uid' => 'user_ä','verified' => '1',
'blocked' => '0', 'created' => '2008-05-13 10:05:25', 'modified' =>
'2008-05-13 10:08:12'),
        array('id' => 7, 'uid' => 'user_e','verified' => '0',
'blocked' => '0', 'created' => '2008-05-13 10:05:25', 'modified' =>
'2008-05-13 10:08:12'),
        array('id' => 8, 'uid' => 'user_é','verified' => '0',
'blocked' => '0', 'created' => '2008-05-13 10:05:25', 'modified' =>
'2008-05-13 10:08:12'),
    );
}

Notice that the fixture imports its schema from the default database.
Notice how the last 4 rows contain two pairs of records using similar
uid-values.
In general collation they should be interperted as two sets of
"duplicates".
In Swedish only the last two should be seen as a duplicate.
In binary they should all be seen as individual records.

That is: this query in my test-case should find either one or two
records:
$swe2 = $this->ContactTest->find('all',array(
        'conditions'=>array(
                'ContactTest.uid'=>'user_é'
        )
));

No matter how much I alter my table I still get exactly the same
results. The Swedish version of them. This is the same when I alter my
table to utf8_bin, utf8_general_ci, utf8_swedish_ci. Always the same
results in the test.

I have checked for the existence of a test table in my default and my
test database.
I have emptied the cache directories of my app.
I have disabled all cache in core.php.
I find what I expect when querying the database directly.

And come to think of it. Since this field has a unique index the
fixture should not even be able to insert the data without throwing an
error for duplicate keys.

This kind of thing really messes with my head since I can never "see"
the created table in my test-database (since as I understand it, it
gets created and dropped on the fly) and I can't see the "Create
table" statement in Cake's sql output. Feels like I am chasing a
ghost.

please enlighten me
/Martin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to