Re: Problem with import in test fixtures?

2008-02-21 Thread Farez

Hi.

Same problem here and can't figure out why that is.

Did you manage to solve it?

Farez

On Feb 1, 5:30 am, Micro <[EMAIL PROTECTED]> wrote:
> Hey, i got the same problem too.  I am stillnotable to import my
> fixtures.
> My cakephp version is: 1.2.0.6311 beta, and my simpletest version is :
> 1.0.1beta2
>
> This is my model:
>
>  class Stock extends AppModel {
>
> var $name = 'Stock';
> var $useTable = 'stocks';
> var $primaryKey = 'SYMBOL';
> var $validate = array(
> );
> ?>
>
> 
> App::import('Model', 'Stock');
>
> class StockTest extends Stock{
> var $name = 'StockTest';
> var $useDbConfig = 'test_suite';
> var $cacheSources = false;
>
>   //   var $useTable = null;
>   //  var $tablePrefix = null;
>
> }
>
> class StockTestCase extends CakeTestCase {
>
> var $fixtures = array('stock_test');
>
> function testCreateRecords() {
>
> $this->TestObject = new StockTest();
> $result = $this->TestObject->findCount();
> $expected = count($this->records);
> $this->assertEqual($result, $expected);
>
>}
>
> }
>
> ?>
>
> My fixture:
> 
> class StockTestFixture extends CakeTestFixture {
>
> var $name = 'StockTest';
> var $import = 'Stock';
>
> var $records = array(
> ...
>
> );
>
> }
>
> ?>
>
> The error that i got is:
>
> Error:  Database table test_suite_stocks for model Stock wasnotfound.
>
> I just don't get it.  I can make myunittesting working without the
> fixture. But, it will go to my real table instead of thetestsuit
> table.  Please help.  I have been trying to do this for couple days
> now.
>
> On Jan 8, 4:35 pm, Robby Anderson <[EMAIL PROTECTED]> wrote:
>
> > Woo hoo! Got it to work. For anyone interested, I believe it had to do
> > with the customtablein my Model declaration (var $useTable).
>
> > To solve my issue, I added two lines to myTestModel declaration:
>
> > class UserTest extends User {
>
> > var $name = 'UserTest';
> > var $useDbConfig = 'test_suite';
> > var $cacheSources = false;
>
> > var $useTable = null;
> > var $tablePrefix = null;
>
> > }
>
> > The last two lines - setting useTable and tablePrefix to null - solved
> > my issue, and now myteststructure/data is importing perfectly! Me
> > = :)
>
> > On Jan 8, 3:55 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > > Robby,
> > > Come to IRC, its much more fun than having to send 4 messages in 2hrs
> > > with no response.
> > > #cakephp, irc.freenode.net
>
> > Th   anks, Gwoo - I'll do that.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Re: Unexpected behaviour in 'required' validation rule (v 1.2)

2007-09-20 Thread Farez

Thanks bujanga. I'll give that a try.

Farez

On Sep 20, 9:13 pm, bujanga <[EMAIL PROTECTED]> wrote:
> Here is an example of a working rule with a required condition.
>
> var $validate = array(
> 'owner_id'  => array(
> 'number'=> array(
> 'rule'  => array('numeric'),
> 'on'=> 'create',
> 'required' => true,
> 'allowEmpty' => false,
> 'message'   => 'Owner ID must exist!'
> )
> )
> );
>
> On 9/19/07, Farez <[EMAIL PROTECTED]> wrote:
>
>
>
> > thanks grigri. seems to be working fine for me without 'allowEmpty'.
> > but the 'required' rule is still a mystery to me.
>
> > On Sep 19, 9:40 am, grigri <[EMAIL PROTECTED]> wrote:
> > > I ran into this too - you need to add the 'allowEmpty' attribute too:
>
> > > 'email' => array('rule'=>VALID_NOT_EMPTY, 'allowEmpty' => true)
>
> > > On Sep 18, 1:51 pm, Farez <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > I'm wondering if I'm doing something wrong here (have searched docs,
> > > > sources and archives and can't find an answer).
>
> > > > The 'required' rule seems to be broken as it still reports an error
> > > > even when the field is not empty. The rule I have is:
>
> > > > 'email' => array('rule'=>'required')
>
> > > > I traced this to this part of the code in Model:invalidFields():
>
> > > > if (method_exists($this, $rule)) {
> > > > $ruleParams[] = array_diff_key($validator, $default);
> > > > $valid = call_user_func_array(array(&$this, $rule), 
> > > > $ruleParams);} elseif (method_exists($Validation, $rule)) {
>
> > > > $valid = call_user_func_array(array(&$Validation, $rule),
> > > > $ruleParams);} elseif (!is_array($validator['rule'])) {
>
> > > > $valid = preg_match($rule, $data[$fieldName]);
>
> > > > }
>
> > > > where it always lands on the preg_match(...) line in the last
> > > > condition, where it tries to preg_match() $rule which has a value of
> > > > 'required', against the data field.
>
> > > > Anyway, I tried using a pattern instead of 'required' and it works,
> > > > like this:
>
> > > > 'email' => array('rule'=>VALID_NOT_EMPTY)
>
> > > > ... but I'm wondering if the 'required' rule is working in 1.2?
>
> > > > Cheers,
> > > > Farez


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Re: Unexpected behaviour in 'required' validation rule (v 1.2)

2007-09-19 Thread Farez

thanks grigri. seems to be working fine for me without 'allowEmpty'.
but the 'required' rule is still a mystery to me.



On Sep 19, 9:40 am, grigri <[EMAIL PROTECTED]> wrote:
> I ran into this too - you need to add the 'allowEmpty' attribute too:
>
> 'email' => array('rule'=>VALID_NOT_EMPTY, 'allowEmpty' => true)
>
> On Sep 18, 1:51 pm, Farez <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm wondering if I'm doing something wrong here (have searched docs,
> > sources and archives and can't find an answer).
>
> > The 'required' rule seems to be broken as it still reports an error
> > even when the field is not empty. The rule I have is:
>
> > 'email' => array('rule'=>'required')
>
> > I traced this to this part of the code in Model:invalidFields():
>
> > if (method_exists($this, $rule)) {
> > $ruleParams[] = array_diff_key($validator, $default);
> > $valid = call_user_func_array(array(&$this, $rule), $ruleParams);} 
> > elseif (method_exists($Validation, $rule)) {
>
> > $valid = call_user_func_array(array(&$Validation, $rule),
> > $ruleParams);} elseif (!is_array($validator['rule'])) {
>
> > $valid = preg_match($rule, $data[$fieldName]);
>
> > }
>
> > where it always lands on the preg_match(...) line in the last
> > condition, where it tries to preg_match() $rule which has a value of
> > 'required', against the data field.
>
> > Anyway, I tried using a pattern instead of 'required' and it works,
> > like this:
>
> > 'email' => array('rule'=>VALID_NOT_EMPTY)
>
> > ... but I'm wondering if the 'required' rule is working in 1.2?
>
> > Cheers,
> > Farez


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Unexpected behaviour in 'required' validation rule (v 1.2)

2007-09-18 Thread Farez

Hi,

I'm wondering if I'm doing something wrong here (have searched docs,
sources and archives and can't find an answer).

The 'required' rule seems to be broken as it still reports an error
even when the field is not empty. The rule I have is:

'email' => array('rule'=>'required')

I traced this to this part of the code in Model:invalidFields():

if (method_exists($this, $rule)) {
$ruleParams[] = array_diff_key($validator, $default);
$valid = call_user_func_array(array(&$this, $rule), $ruleParams);
} elseif (method_exists($Validation, $rule)) {
$valid = call_user_func_array(array(&$Validation, $rule),
$ruleParams);
} elseif (!is_array($validator['rule'])) {
$valid = preg_match($rule, $data[$fieldName]);
}

where it always lands on the preg_match(...) line in the last
condition, where it tries to preg_match() $rule which has a value of
'required', against the data field.

Anyway, I tried using a pattern instead of 'required' and it works,
like this:

'email' => array('rule'=>VALID_NOT_EMPTY)

... but I'm wondering if the 'required' rule is working in 1.2?

Cheers,
Farez


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Re: Newbie Introduction Book ... reviews anyone?

2007-07-30 Thread Farez

Way to go Dave... you certainly have a good writing style. This would
be very useful to all.

Farez

On Jul 27, 7:14 pm, Dave <[EMAIL PROTECTED]> wrote:
> I'm working on a Newbie's Introduction to CakePHP book and would like
> to invite anyone who would like to review it for errors or
> considerations I may have overlooked. Let me know, and I'll send you a
> PDF copy of the current edition.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Re: Mambo to use CakePHP for V5

2007-07-26 Thread Farez

How nice to see the Mambo team coming on and introducing themselves
personally.

It is certainly great to see a major OS group adopting CakePHP as it
is testament to this great framework we all know and love here.

This move is also filling in a real need as I think a lot of us bakers
at some point or another will need to build on a CMS but is always
faced with the dilemma of rolling our own with Cake or just work with
the CMS's native platform. Kudos to Mambo for taking this bold step of
merging the two.

So, to echo the others here - Welcome Mambo!

Farez



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---