Learning FUEL CMS PART 5: Testing Your Site

In our last post we discussed how to import the static pages and blocks of the WidgiCorp demo site so they could be managed in FUEL CMS. This post will dive into testing and examining the page content of the WidgiCorp site using the SEO Module, Validate Module and Tester Module found in FUEL CMS.

The SEO Module

The SEO module within FUEL contains the Page Analysis and Google Keywords sub modules that help you with SEO optimization.

Page Analysis

The SEO Page Analysis tool is an easy way to look at a specific page of your site outside of the context of the layout and design — similar to how a search engine looks at your site. The analysis lists the page title, meta description, meta keywords, heading tags (h1, h2, h3 and h4), word count, first 100 words and image alt attributes ({EMPTY} will appear if an alt attribute is empty).

Google Keywords

The SEO Google Keywords tool is used to check a certain domain's ranking in Google provided one or more keywords. The configuration file (fuel/modules/seo/config/seo.php) allows you to specify default keywords and additional google parameters.

The search rankings may not exactly match what you see when you search. This is because FUEL uses CURL to grab the Google Search results and not your web browser which can cause some slight differences. You can also edit the google parameters in the fuel/modules/seo/config/seo.php to alter the results (e.g. $config['seo']['keyword_google_additional_params'] = array('gl' = 'US'); which shows search results specific to the United States).

Validate Module

The Validate Modules allows you to validate page links, HTML code and page weight by selecting one or more of the pages listed, and clicking the appropriate button. Additional pages can be added either by copy and pasting into the text area or by modifying the default_page_input in the fuel/modules/validate/config/validate.php configuration file.

Validate Links

Clicking the Validate Links button will examine the selected pages for links and verify that they don't return any server errors (.e.g. 404 error). Any pages with broken links will list the problem links.

Validate HTML

Clicking the Validate HTML button allows you to validate your pages HTML using the W3C's HTML validator.

It is important not to submit too many pages at once or it may cause you to be temporarily banned from using the W3C validator. If you are needing to validate a high number of pages, you may want to consider installing the validator locally and altering the fuel/modules/validate/config/validate.php file appropriately to point to the local validator.

Pages that can be edited in the CMS will have and Edit link next to the refresh button.

Calculate Page Weight

Clicking the View Page Weight button will calculate the size of the HTML page, images, external javascript and CSS and provide a report for each page. The configuration parameter size_report_warn_limit in the fuel/modules/validate/config/validate.php sets the warning limit threshold.

Tester Module

The Tester Module gives you a convenient way to exercise your site's code. It can test your models and library classes and can even test your views and controllers. For the WidgiCorp site, we wrote some basic tests which are located in the fuel/application/tests/Widgicorp_test.php file. The test_no_general_page_errors() tests all the pages for various types of errors including database connection, php and 404 errors. The key to this test is the pq() function which allows you to query a pages DOM structure using jQuery like syntax thanks to phpQuery.


// TEST 1 test general page errors
public function test_no_general_page_errors()
	$pages = $this->_get_pages();

	foreach($pages as $page)
		$test = $this->_check_errors();
		$expected = FALSE;
		$this->run($test, $expected, 'Test for general page errors on page: '.$page);


private function _check_errors()
	$error = ($this->_has_404_error() OR $this->_has_db_error() OR $this->_has_general_error() OR $this->_has_php_error());
	return $error;

//for more on pq function 
private function _has_404_error()
	return pq("#error_404")->size();

private function _has_db_error()
	return pq("#error_db")->size();

private function _has_general_error()
	return pq("#error_general")->size();

private function _has_php_error()
	return pq("#error_php")->size();

It is recommended that you read the Tester Module documentation and view the entire fuel/application/tests/Widgicorp_test.php file to get a better understanding of how to write tests for your websites using FUEL.

That's it for Part 5: Testing Your Site. We covered the basics of testing, analyzing and optimizing the WidgiCorp demo site. We encourage you to join the community, sign up for our newsletter below, and/or follow us on Twitter, to stay informed on the latest FUEL CMS news. Stay tuned for Part 6: The Client Handoff.

Comments have been turned off for this post.

  Back to Top