Re: Testing fixtures

2014-08-02 Thread euromark
Usually they are automatically resettted
What's your setup?


Am Samstag, 2. August 2014 09:32:07 UTC+2 schrieb Jeremy Burns:
>
> When I run my 'All models' test I can get different results than when I 
> run each model individually, presumably because loaded fixtures have been 
> updated in previous tests. How can I clear down previously loaded fixtures 
> at the beginning of each test suite?
>

-- 
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+unsubscr...@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.


Testing fixtures

2014-08-02 Thread Jeremy Burns
When I run my 'All models' test I can get different results than when I run 
each model individually, presumably because loaded fixtures have been 
updated in previous tests. How can I clear down previously loaded fixtures 
at the beginning of each test suite?

-- 
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+unsubscr...@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.


Re: Lost in Testing: Fixtures / testAction

2011-02-26 Thread acl68
Hi Ryan,

thank you for your research that helps me at least with the redirect.


What I still don't understand is how the data at 
/tests/fixtures/somemodel_fixture.php relates to the $this->Somemodel->data 
Array im Marks tutorial. When do I use which? Do I use both? 

Thanks for any hints!

Anja


Am Samstag, 26. Februar 2011, um 00:19:31 schrieb Ryan Schmidt:
> On Feb 25, 2011, at 07:06, acl68 wrote:
> > Also: does anybody know what happened to the link in "4.7.6.3 Pitfalls"
> > http://book.cakephp.org/#!/view/1213/Pitfalls in the cookbook? The Link
> > to the mentioned tickets doesn't work. So I am not sure how to proceed,
> > because nearly all my methods use redierts after the did what they
> > should do.
> 
> Your link did not work for me, but I used the search field and typed in
> "pitfalls" and it got me to
> 
> http://book.cakephp.org/view/1213/Pitfalls
> 
> which did work. All it says is:
> 
> "If you use testAction to test a method in a controller that does a
> redirect, your test will terminate immediately, not yielding any results.
> 
> "See https://trac.cakephp.org/ticket/4154 for a possible fix."
> 
> 
> And I see trac.cakephp.org no longer works. I know the team has moved from
> Trac to Lighthouse for issue tracking, and as I understand it, has not
> necessarily copied all old issues from Trac to Lighthouse.
> 
> Here is a cached version of that ticket:
> 
> http://webcache.googleusercontent.com/search?q=cache:hK6fIPD0bqgJ:https://t
> rac.cakephp.org/ticket/4154

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Lost in Testing: Fixtures / testAction

2011-02-25 Thread Ryan Schmidt

On Feb 25, 2011, at 07:06, acl68 wrote:

> Also: does anybody know what happened to the link in "4.7.6.3 Pitfalls" 
> http://book.cakephp.org/#!/view/1213/Pitfalls in the cookbook? The Link to 
> the 
> mentioned tickets doesn't work. So I am not sure how to proceed, because 
> nearly all my methods use redierts after the did what they should do.

Your link did not work for me, but I used the search field and typed in 
"pitfalls" and it got me to

http://book.cakephp.org/view/1213/Pitfalls

which did work. All it says is:

"If you use testAction to test a method in a controller that does a redirect, 
your test will terminate immediately, not yielding any results. 

"See https://trac.cakephp.org/ticket/4154 for a possible fix."


And I see trac.cakephp.org no longer works. I know the team has moved from Trac 
to Lighthouse for issue tracking, and as I understand it, has not necessarily 
copied all old issues from Trac to Lighthouse.

Here is a cached version of that ticket:

http://webcache.googleusercontent.com/search?q=cache:hK6fIPD0bqgJ:https://trac.cakephp.org/ticket/4154



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Lost in Testing: Fixtures / testAction

2011-02-25 Thread acl68
Hi everybody,

I am using Cake 1.3. and am just doing my first steps with testing ever. 

I had a look at 
http://book.cakephp.org/#!/view/1210/Testing-controllers
and worked through Marks Tutorial 
http://mark-story.com/posts/view/testing-cakephp-controllers-the-hard-way

Since I am completely new to testing and quite stumbling around I am not sure 
how these two relate to each other. Are those different concepts in testing 
controllers? 

Also: does anybody know what happened to the link in "4.7.6.3 Pitfalls" 
http://book.cakephp.org/#!/view/1213/Pitfalls in the cookbook? The Link to the 
mentioned tickets doesn't work. So I am not sure how to proceed, because 
nearly all my methods use redierts after the did what they should do.


Thanks in advance for any help!

Anja

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Testing: Fixtures on related tables

2009-03-17 Thread Aurelius

Hi!

I want to use fixtures for my tests, I have a Model User which
hasAndBelongToMany Languages

So I created the fixtures:
user_fixture.php
languages_user_fixture.php
language_fixture.php

But as soon as I add following to users_controller.test.php
var $fixtures = array( 'user');
or
var $fixtures = array( 'user', 'language');
I get the error message:
Missing Database Table
Error:  Database table test_suite_languages for model Language was not
found.

What do I have to do?

thx
Aurelius
--~--~-~--~~~---~--~~
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: Controllers testing - fixtures problem

2009-02-12 Thread Raph

It's weird... When I did like you said Martin, didn't work, but if i
write something like:

public function testIndex() {
$result = $this->testAction('/news/index', array(
'connection' => 'test',
'return' => 'vars',
'method' => 'get'
));
debug($result);
}

It's looks like test DB working. What's going on with this
"fixturize=>true"?

Martin - thx for suggestion. :)

On 12 Lut, 14:03, Martin Radosta  wrote:
> try adding the connection to the array
>
> public function testIndex() {
>     $result = $this->testAction('/news/index', array(
>             'connection'    => 'test',
>             'fixturize' => true,
>             'return' => 'vars'
>     ));
>     debug($result);
>
> }
> On Thu, Feb 12, 2009 at 8:12 AM, Raph  wrote:
>
> > I have a problem with using fixtures in my controller test. When I use
> > fixtures in my model test everything is ok (tests pass without
> > exectpions), but in controller tests I have exceptions in tests with
> > table missing errors.
>
> > I read posts about issues like mine which suggest that it was fixed,
> > but I have last release of Cake and it dosen't help.
>
> > This is code of my controller test:
>
> > class NewsControllerTestCase extends CakeTestCase {
> >    public $fixtures = array('app.news');
>
> >    public function startCase() {
> >        echo 'Starting Test Case';
> >    }
>
> >    public function endCase() {
> >        echo 'Ending Test Case';
> >    }
>
> >    public function startTest($method) {
>
> >        echo 'Starting method ' . $method . '';
> >    }
>
> >    public function endTest($method) {
> >        echo '';
> >    }
>
> >    public function testIndex() {
> >        $result = $this->testAction('/news/index', array(
> >                'fixturize' => true,
> >            'return' => 'vars'
> >        ));
> >        debug($result);
> >    }
> > }
>
> > I have error "Table 'test_db.news' doesn't exist" three times.
>
> > Any ideas?
--~--~-~--~~~---~--~~
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: Controllers testing - fixtures problem

2009-02-12 Thread Martin Radosta
try adding the connection to the array

public function testIndex() {
$result = $this->testAction('/news/index', array(
'connection'=> 'test',
'fixturize' => true,
'return' => 'vars'
));
debug($result);
}


On Thu, Feb 12, 2009 at 8:12 AM, Raph  wrote:

>
> I have a problem with using fixtures in my controller test. When I use
> fixtures in my model test everything is ok (tests pass without
> exectpions), but in controller tests I have exceptions in tests with
> table missing errors.
>
> I read posts about issues like mine which suggest that it was fixed,
> but I have last release of Cake and it dosen't help.
>
> This is code of my controller test:
>
> class NewsControllerTestCase extends CakeTestCase {
>public $fixtures = array('app.news');
>
>public function startCase() {
>echo 'Starting Test Case';
>}
>
>public function endCase() {
>echo 'Ending Test Case';
>}
>
>public function startTest($method) {
>
>echo 'Starting method ' . $method . '';
>}
>
>public function endTest($method) {
>echo '';
>}
>
>public function testIndex() {
>$result = $this->testAction('/news/index', array(
>'fixturize' => true,
>'return' => 'vars'
>));
>debug($result);
>}
> }
>
> I have error "Table 'test_db.news' doesn't exist" three times.
>
> Any ideas?
>
>
>
> >
>

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



Controllers testing - fixtures problem

2009-02-12 Thread Raph

I have a problem with using fixtures in my controller test. When I use
fixtures in my model test everything is ok (tests pass without
exectpions), but in controller tests I have exceptions in tests with
table missing errors.

I read posts about issues like mine which suggest that it was fixed,
but I have last release of Cake and it dosen't help.

This is code of my controller test:

class NewsControllerTestCase extends CakeTestCase {
public $fixtures = array('app.news');

public function startCase() {
echo 'Starting Test Case';
}

public function endCase() {
echo 'Ending Test Case';
}

public function startTest($method) {

echo 'Starting method ' . $method . '';
}

public function endTest($method) {
echo '';
}

public function testIndex() {
$result = $this->testAction('/news/index', array(
'fixturize' => true,
'return' => 'vars'
));
debug($result);
}
}

I have error "Table 'test_db.news' doesn't exist" three times.

Any ideas?



--~--~-~--~~~---~--~~
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: testing/fixtures: load different records on demand

2009-01-12 Thread mark_story

Currently fixtures are not that sophisticated.  You get all or
nothing.  One solution is to do what websta* suggested and have two
fixtures, or modify the fixture.  But currently fixtures are pretty
unaware with regards to how many records they have / are inserting.

-Mark

On Jan 12, 3:49 pm, David  wrote:
> Hi!
> I am using fixtures for my test methods and I'm not sure if it's
> possible, but I would like to load different records on demand in the
> different test methods. I know that you can load different fixtures
> with loadFixtures() and setting $autoFixtures to false, but I would
> like to load in one method only one record, and in another method like
> 30 records.
> Thanks.
> David
--~--~-~--~~~---~--~~
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: testing/fixtures: load different records on demand

2009-01-12 Thread websta*

IM pretty certain... ( crosses fingers ) that you would just use a different
fixture in this case

Or you could maybe pull some trickery in MyFixture::init to reduce records (
untested, but should do it )

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of David
Sent: Tuesday, January 13, 2009 9:49 AM
To: CakePHP
Subject: testing/fixtures: load different records on demand


Hi!
I am using fixtures for my test methods and I'm not sure if it's
possible, but I would like to load different records on demand in the
different test methods. I know that you can load different fixtures
with loadFixtures() and setting $autoFixtures to false, but I would
like to load in one method only one record, and in another method like
30 records.
Thanks.
David


No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.176 / Virus Database: 270.10.6/1888 - Release Date: 1/12/2009
7:04 AM


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



testing/fixtures: load different records on demand

2009-01-12 Thread David

Hi!
I am using fixtures for my test methods and I'm not sure if it's
possible, but I would like to load different records on demand in the
different test methods. I know that you can load different fixtures
with loadFixtures() and setting $autoFixtures to false, but I would
like to load in one method only one record, and in another method like
30 records.
Thanks.
David

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