 | News Feed |
Sections
Community Events
|
| feed this: |  |
Larry Garfield's Blog: Drupal 7 gets introspective code registry
posted Thursday May 08, 2008 @ 12:53:14
voice your opinion now!
BY CHRIS CORNUTT
Larry Garfield talks about a new feature of Drupal 7 in a new post to his blog - the new introspective code registry that's been introduced in this latest version.
As a GHOP Task , Cornil did a performance analysis of Drupal and found its two largest performance drains were the bootstrap process and the theming layer. Quite simply, Drupal spends too much time including code. [...] Fortunately, Drupal 7's self-learning code registry system has just landed, which should obliterate most of the wasted bootstrap cost.
Larry describes the "heart of it all", the token_get_all call, that parses through an entire PHP file, splitting out things like classes included and functions called. This is passed through a function_exists call to the current script and, if it's already there, the file isn't included repetitively.
tagged with: drupal cms code registry tokengetall system functionexists
Debuggable Blog: Code Coverage Analysis soon in CakePHP - Test How Well You Test
posted Thursday May 01, 2008 @ 11:19:54
voice your opinion now!
BY CHRIS CORNUTT
In a new post to the Debuggable blog, Tim Koschutzki talks some about the work he's been doing on the code coverage analysis for the upcoming CakePHP release:
There are several different kinds of criteria to code coverage. The two most important ones are line coverage (or statement coverage as wikipedia puts it) and path coverage. [...] So how is it going to work? Pretty simple actually. Whenever you run a CakePHP test case Cake assembles information in the background about which lines of your subject-under-test are called.
He includes a few screenshots of the code coverage being run and the end result of the runner with the percent covered.
tagged with: code coverage cakephp framework test unittest
Richard Heyes' Blog: Reading a specific line in a file
posted Monday April 07, 2008 @ 12:56:08
voice your opinion now!
BY CHRIS CORNUTT
Richard Heyes has thrown together some code for a simple thing that he's seen developers request over and over again - moving to/reading from a specific line in a file.
After reading something on the php-general list I decided that a) I'm bored, and b) I'll write something which handles it. So here it is.
His code is simple - looping through the lines of the file until it locates your desired target (with some error checking along the way). Plus, if it's already fetched, it keeps it in a cached array for future retrieval.
tagged with: reading specific file line example code class
Rob Allen's Blog: Simple Zend_Form File Upload Example
posted Monday April 07, 2008 @ 09:30:30
voice your opinion now!
BY CHRIS CORNUTT
Rob Allen has posted an example (a simple one to get you started) of creating a file upload form in the Zend Framework.
Zend Framework 1.5's Zend_Form component is missing support for the file input element as it is waiting on a file upload component to build upon. We're busy people, so we'll fake it...
His example gives a screenshot of the end result and includes all of the code needed to make it all work - the form, the custom file form element, a ValidFile validation class to ensure you're getting exactly what you want and the controller to define the form and execute it once the user submits.
tagged with: zendform validate example code zendframework
Sebastian Bergmann's Blog: Generating Code from Tests
posted Thursday March 13, 2008 @ 08:43:50
voice your opinion now!
BY CHRIS CORNUTT
Sebastian Bergmann has posted a quick example of how to use the PHPUnit unit testing suite for PHP to create code for you (assuming you're using the test first method of development.
His example builds the class off of a set of test for a "BowlingGame" that ends up with roll() and score() methods based off of the naming conventions used in the test:
Following the convention that the tests for a class BowlingGame (see below) are written in a class named BowlingGameTest (see above), the test case class' source is searched for variables that reference objects of the BowlingGame class and analyzing what methods are called on these objects.
tagged with: phpunit generate code unittest testfirst programming
|