Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
nanoftpd-0.0.2.tar_.gz | 21.8 KB | chx |
Comments
Comment #1
JacobSingh CreditAttribution: JacobSingh commentedI 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.
Comment #2
chx CreditAttribution: chx commentedHowever, 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.
Comment #3
chx CreditAttribution: chx commented