Tuesday, October 21, 2014

Question about Fixture subdirectories in 2.5.5

Hi all,

I upgraded from 2.4.5 to 2.5.5 to enjoy the benefit of using subdirectories to organize my test fixtures.

However, I'm having difficulties with getting Cake to find my fixtures once they've been moved to subdirectories.  This seems to be due to the fact that my Fixture names and class names start with uppercase letters.  

For example, I might have a class called MultipleUsersFixture in a file /Test/Fixture/User/MultipleUsersFixture.php .  
When I try to reference this fixture in a test by adding 'User/multiple_users' to the $fixtures array, I get the following error:

Referenced fixture class User/multipleUsers (Test/Fixture/User/multipleUsersFixture.php) not found


Digging into the Cake code a little bit, it looks like the Inflector ultimately calls ucwords on the fixture class name, which does not capitalize any words immediately following a '/' character.

Is this a situation where I need to rename all of my classes and filenames to comply with the constraints placed on me by the inflector?  Or am I missing something here?  I've googled around and don't see many examples out there of fixtures that use subdirectories (including the Cake framework itself).

Thanks!

--
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: