开发者

PHP - Simpletest - Comparing numeric strings

I'm trying to use simpletest to compare two numeric strings, one from an array and one from an object property.

I've printed out the values and they are equal, however, the test always returns false. Can anyone help?

Here's the code:

$this->assertEqual(strval($this->createdforums[$randomforum]),
(strval($forum->getTitle)));

   print_r($this->createdforums[$randomforum]);
   print_r('<br />');
   print_r($forum->getTitle());

The values that get printed o开发者_如何学Pythonut are:

1250833961 1250833961

Any advice appreciated. Thanks.


You missed the brackets off getTitle in the assert. should be...

$this->assertEqual(strval($this->createdforums[$randomforum]),
(strval($forum->getTitle())));


Maybe you have some spaces around the values. Try to trim() them before comparing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜