PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed Aug 15, 2018 4:22 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Jan 07, 2010 4:15 pm 
Offline
Forum Newbie

Joined: Fri Dec 11, 2009 5:55 pm
Posts: 10
Hello! I am new to PHPUnit testing and have one question.

I use NetBeans. Configured PHPUnit and got it working. When I create a Test out of existing class "UsersDAO.php" using Nestbeans's special menu options for creating Tests then Netbeans generates Test class and methods and when I Run the Test on UsersDAO.php then everything works ok. Test methods execute and I have the report. When I write test code and play with $this->assertNotEquals() some tests fails some tests pass. Everything is working.

My problem is that I created a new Test class not using Netbeans options to Generate test methods. Placed this new class in same Tests folder where other Test classes are located but when I run this class the tests methods are not called! Why? I get a waring message that

"No tests found in class "InviteUsersTest".

:( May I ask you to advise me where is the problem. Here is my shortened Test class which I believe should execute because it does have one test method.


Syntax: [ Download ] [ Hide ]
<?php
ini_set("include_path", "../db".PATH_SEPARATOR."../../db".PATH_SEPARATOR.ini_get("include_path"));
require_once 'PHPUnit/Framework.php';
require_once 'C:\phpprojects\InviteUsersToValidate\db\UserDAO.php';
require_once 'C:\phpprojects\InviteUsersToValidate\db\UserVO.php';

class InviteUsersTest extends PHPUnit_Framework_TestCase
{
    public function getNotValidatedUsers()
    {
        $dao = new UserDAO();
        $dao->openConnection();
        $records = $dao->getNotValidatedUsers();
        $this->assertNotNull($records);

        $countRecords = count($records);
        $this->assertNotEquals(0, $countRecords);
        $dao->closeConnection();
    }
}

?>
 


Thank you!


Last edited by Weirdan on Sat Jun 19, 2010 4:33 am, edited 1 time in total.
added syntax highlighting


Top
 Profile  
 
PostPosted: Thu Feb 11, 2010 4:05 pm 
Offline
DevNet Master

Joined: Wed Feb 11, 2004 4:23 pm
Posts: 4872
Location: Palm beach, Florida
Test method must start with "test"


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group