Although Drupal SimpleTest is an extremeley useful module it doesn't currently support data providers, which is a shame as I use that feature quite a bit in other testing frameworks. A data provider is a mechanism that allows you to call a single test case multiple times with different arguments so that you can ensure the correct output each time.
Saturday 30th June saw a one off event organised by the PHPNW community called LAMP and Beyond. The idea was that it would bring together people of differing abilities with the aim of sharing skills and experience with servers, programming, source control, or whatever happened to be of interest at the time.
The du (or 'disk usage') command is a Linux command that can print a list of the files within a directory including their sizes and even summarize this information. It is useful if you want to see how large a group of files is and provides more information about directories than the ls command does.
There might be a couple of reasons why you would want to do this. Perhaps the repository has been checked out instead of exported, or maybe the repository doesn't exist any more. A couple of strategies exist remove all SVN files from a set of directories in Linux. You can either use the rm command directly and pass in a find command using grave accent quotes (key to left of '1').
Use the following command to find out how many commits there have been in a git repository. Not really useful in itself, but an interesting figure to see how active a project has been over it's lifetime.
git log --oneline --all | wc -l
The following git log flags are in use here:
--oneline - Removes some of the information from the log entries and displays each on a single line.
--all - Shows all commits across all branches.
Git will track changes to files and directories, including any changes to permissions done via chmod. In most development environments I tend to have a different set of permissions to those on the live site so I am usually not interested in tracking permissions changes. To prevent git from looking at the difference between the permissions of a file you need to set the core.filemode configuration option to false.
When copying the standard ouput from within a terminal I often push it to a file using the "command > file" syntax. The trouble is that I then end up with a file that I have to open in order to get the output, and I often forget to delete the file once finished. This is especially annoying when I just want to paste some debug output into a help topic or similar. The solution to this is to use xclip to store the output in the xclipboard instead of a file. This is essentially the function of xclip, it allows access to a clipboard that you can store anything in.
I am currently using SimpleTest to test a complex multi-step form implementation in Drupal 7. It made sense to do it this way as there are a lot of factors involved that all need to be accounted for and automating what form elements appeared on what page was the most robust solution. In order to test how the form worked I needed to submit to the form once (using a $this->drupalPost() method) and then submit the form again using the same method. The tricky bit here was that when calling the drupalPost() method with a URL it first called drupalGet() on the URL before posting to the form.
Altering text in Drupal 7 is quite simple thanks to things like string overrides that allow you to replace all instances of a string throughout a site. If you want to change a single element on a single form then string overrides don't quite work, but using hook_form_alter() or hook_form_form-id_alter() allows you to manipulate any form in a Drupal site.
The good thing about working in a city like Manchester is that there is an active digital community. This means that there are quite a few digital events as well as a number of communities and user groups. I have been going to (and even organising) local user groups for a while now and I always learn something or help someone out, but the groups are more than that.