Fixture file is not being loaded during tests.

2010-09-27 Thread Ricardo
Hi guys, I'm trying to test a model. The first problem I faced was
having to load all fixtures from all the related models. The issue is
well known and, just to get up and running fast, I loaded all fixtures
in my startTest function, as I show bellow:

function startTest() {
$fixturesPath = APP . 'tests' . DS . 'fixtures';

$handle = opendir($fixturesPath);

while (false !== ($file = readdir($handle))) {
  $fixtureFileName = 'app.' . substr($file, 0, strpos($file,
'_fixture'));

  if ($fixtureFileName != 'app.') {
$this->fixtures[] = $fixtureFileName;
  }
}

$this->Order = & ClassRegistry::init('Order');
}

I could make the test run. But then I noticed the OrderFixture file,
despite being in the fixture array, does not get loaded. I can even
write random stuff in the file and there no errors and the tests keep
passing.

Does anyone know how to fix it? I want to have control over the
records in the test database. The way it's today, the model is loading
live data in the tests!

Thanks in advance,

zehzinho

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CakePHP 1.3.0-RC3 unleashed

2010-04-06 Thread Ricardo
Having validate = first per default in saveAll() was terrible.
Automatically saving related data is not possible anymore, since the
foreign keys are not set before the main model is saved. =/

On Apr 1, 10:53 pm, jacmoe  wrote:
> For the record:
> I my RC2 powered app, I had this piece of code:
>                     $save_data['some_field'] = $some_value;
>                     $save_data['other_field'] = $some_other_value;
>                     $SomeModel->save($save_data);
> That worked in RC2, but failed in RC3.
> I changed it to:
>                     $save_data['ModelName']['some_field'] =
> $some_value;
>                     $save_data['ModelName']['other_field'] =
> $some_other_value;
>                     $SomeModel->save($save_data);
> And it works. Of course.
> The other behaviour was a bug.
>
> On Mar 30, 4:27 pm, jacmoe  wrote:
>
> > I spoke too soon:
> > The upgrade from RC2 to RC3 broke my app. :(
> > Just a warning.
> > Reverting to RC2.
> > I think it has to do with me using extra fields in my model not in the
> > database, but I'm not sure.
>
> > On Mar 30, 12:30 am, jacmoe  wrote:
>
> > > Congratulations! :)
>
> > > You have come a long way since the early 1.3 pre-releases.
> > > I tried upgrading my app to it some time ago, and nothing worked the
> > > way it should.
>
> > > Now, everything works, even the things which I never could have gotten
> > > to work using Cake 1.2 :D
> > > Great stuff.
>
> > > Now all we need is lots of tutorials about how to use the new
> > > JsHelper. :)
>
> > > Cake 1.3 - better than ever.
>
> > > Thanks a lot! :)
>
> > > On Mar 29, 1:26 am, mark_story  wrote:
>
> > > > The CakePHP development team is happy to announce the release the
> > > > CakePHP 1.3.0-RC3. This release is the second last release candidate
> > > > for 1.3.0. Since 1.3.0-RC2 was released 2 weeks ago there have been
> > > > over 80 commits and 35 tickets fixed. The plan is to have one more
> > > > release candidate, and then 1.3.0 stable. After 1.3.0 stable is
> > > > released it will enter a maintenance period similar to 1.2.
>
> > > > There have been no major features added since the last Release
> > > > Candidate. There has been a minor change in Model::saveAll().  By
> > > > default it will do a validate = first by default now.  This was done
> > > > to resolve unexpected behavior differences between Model::save() and
> > > > Model:saveAll().
>
> > > > In other project news, the API has been updated to no longer require
> > > > Javascript to view formatting.  Additionally more internal links have
> > > > been created.  The 1.3 book has been receiving a healthy amount of
> > > > translation attention. There is now greatly expanded documentation in
> > > > German, French and Vietnamese. To everyone who has contributed thank
> > > > you and keep up the good work.
>
> > > > We'd like to thank everyone who has contributed documentation, tickets
> > > > and code between the last release and now.
>
> > > > Download a packaged release [1]
> > > > View the changelog [2]
>
> > > > [1]http://github.com/cakephp/cakephp1x/downloads
> > > > [2]http://cakephp.lighthouseapp.com/projects/42648/changelog-1-3-0-rc3

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using "remove me" as the subject.


Re: displayField is not in the database (mixed models?)

2009-09-17 Thread Ricardo

Hi, I'm having a similar issue and would also appreciate some help :)
I'm setting the 'name' field in the afterFind method, but my select
still generates ids as options.

On Sep 16, 4:44 am, Walther  wrote:
> I have no experience in this, but a custom data source might be the
> way to go.
>
> On Sep 15, 4:53 pm, iFeghali  wrote:
>
> > Hello Brian,
>
> > Thank you for your reply. Yes, that could be an alternative but it
> > would require lots and lots of changes. I am not talking about only
> > one single "select", but all the places in the application that refers
> > to a "User" (there are many of them). Anyway I am curious to know
> > whether I can foo "find('list')" to gather its values from the final
> > array (returned by "afterFind") instead of the database.
>
> > Best,
> > ~IF.
>
> > On Sep 15, 9:29 am, brian  wrote:
>
> > > You could just create the select list yourself, using a loop, rather
> > > than have FormHelper do it. Just make sure the name attribute is as
> > > Cake expects it to be.
>
> > > On Tue, Sep 15, 2009 at 8:00 AM, iFeghali  wrote:
>
> > > > Hello All,
>
> > > > I just got stuck with a little issue that I would appreciate any help.
> > > > I have got a Model that is partially stored in a database, and the
> > > > other attributes are gathered in the "afterFind" time. For instance,
> > > > given a model "User" the username is in the database but all the user
> > > > data (full name and etc.) are on NIS. So when I query the user
> > > > database I got only the usernames but when afterFind is triggered it
> > > > loads the data off NIS for all of them.
>
> > > > Given that I want to keep things that way (that is, what is in NIS
> > > > should be kept in NIS only) how would I make the displayField of User
> > > > point to a "field" that is generated only in afterFind (like full
> > > > name) ?
>
> > > > Best,
> > > > ~IF.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to load initial data?

2009-09-02 Thread Ricardo

Hi Vijay Kumbhar, thanks for you answer, but I have already read it.
I'm actually not THAT beginner. I wanted a higher level solution, like
the migration plugins, not SQL. Does anyone know something like this?

On Wed, Sep 2, 2009 at 1:24 PM, Vijay Kumbhar wrote:
> Hello Ricardo,
>
> Please try out with the basic cakephp assignment,
>
> http://book.cakephp.org/view/219/Blog
>
>
> 2009/9/2 Zé Ricardo 
>>
>> Hi, I'm a cakephp beginner and I'm wondering how I can load initial
>> data in my database (eg. some users and groups). I thought fixtures
>> could do the task, but it seems that they can only be used for tests,
>> right?
>>
>> Is there a plugin or even a standard way to do it? I've found some
>> migration scripts, but they have not helped me so far.
>>
>> Thanks in advance.
>>
>>
>
>
>
> --
> Thanks & Regards,
> Vijayk.
> Co-founder (www.weboniselab.com)
>
> "You Bring the Dreams, We'll Bring the Means"
>
> >
>

--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



how to load initial data?

2009-09-02 Thread Ricardo

Hi, I'm a cakephp beginner and I'm wondering how I can load initial
data in my database (eg. some users and groups). I thought fixtures
could do the task, but it seems that they can only be used for tests,
right?

Is there a plugin or even a standard way to do it? I've found some
migration scripts, but they have not helped me so far.

Thanks in advance.

--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---