More plans

I’ve created several helper methods for Database class:

  • truncateTable()
  • countRecords()

I’ve also created base class DatabaseBaseTest which uses those methods heavily.

As for unit testing, I’ve impelented SyslogSessionMapper tests for several methods, but refactoring base classes have taken too much time.

save() method internally uses insertSession() and updateSession() (for non-persistent / persistent sessions accodingly ). First method is tested, second my is my future plan. I also need to unit test save() method.

As for delete() method — there will be some difficulties. Before I delete session object I have to delete all related syslog messages (by session_id foreign key in “syslog” db table). Currently SyslogMessageMapper isn’t implemented, so I need manually insert records into syslog messages table for unit testing delete() method

Additionally we do need getLatestSession() method which will retrieved latest session object from database. SQL will looks like:


  select id,max(start_date),end_date from syslog_sessions

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: