We discussed with snufkin how to test the IRC bot and he indeed writen a client-server pair of simpletest using the existing CLI running script which forks. So we can take that, http://www.rawseo.com/tools.html nanoftp and cook up a test that actually connects to FTP and uploads files.

CommentFileSizeAuthor
nanoftpd-0.0.2.tar_.gz21.8 KBchx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JacobSingh’s picture

I don't think this is useful. Testing if FTP works (generally as a protocol) is outside the purview of Drupal. If our code is small enough and clear enough, we should be able to isolate calls to ftp, and mock up the ones we cannot isolate.

This is a tenet of unit testing I think is very useful: The ability to separate what the code does from what other code (an FTP server) might be doing or the conditions where the test is run.

A unit test forces you to write code which can be broken down into component pieces, each of which can be validated independently. Look into Mock classes for ways to simulate activities with a server if absolutely needed.

chx’s picture

However, if we do a functional testing then we test the actual class instead of a mock class. Even with runkit you cant simulate the wrapper for example... so i believe writing this test is quite meaningful.

chx’s picture

Assigned: chx » Unassigned
Issue summary: View changes