Flipkart

Monday, July 26, 2010

Install Google Chrome with YUM on Fedora 13, Red Hat

Add following to /etc/yum.repos.d/google.repo file:
32-bit

[google]
name=Google - i386
baseurl=http://dl.google.com/linux/rpm/stable/i386
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

64-bit

[google64]
name=Google - x86_64
baseurl=http://dl.google.com/linux/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

Note: Both 32-bit and 64-bit repos can be placed in the same file.

## Install Google Chrome Stable version
yum install google-chrome-stable

## OR install Google Chrome Beta version##
yum install google-chrome-beta

## OR install Google Chrome Unstable version##
yum install google-chrome-unstable

Thursday, July 1, 2010

Simpletest: submitFormByName

The SimpleTest PHP unit tester and web test framework.It has support for SSL, forms, frames, proxies and basic authentication. The idea is that common but fiddly PHP tasks, such as logging into a site, can be tested easily.

Unfortunately Simpletest doesnot provide a function for submit a form with its Name.But we can implement this function by 3 small changes in 3 different files.

1)browser.php 
        In this add below code

    function submitFormByName($name) {
        if (! ($form = &$this->_page->getFormByName($name))) {
            return false;
        }
        $success = $this->_load(
                $form->getAction(),
                $form->submit());
        return ($success ? $this->getContent() : $success);
    }


2)Page.php
        Add below function

    function &getFormByName($name) {
        for ($i = 0; $i < count($this->_complete_forms); $i++) {
            if ($this->_complete_forms[$i]->getName() == $name) {
                return $this->_complete_forms[$i];
            }
        }
        $null = null;
        return $null;
    }


3)Form.php

         Here u have to declare variable caleed
                     $this->_name = $tag->getAttribute('name'); 
        in constructor(SimpleForm) then add the function

    function getName() {
        return $this->_name;
    }


 Thats all. Now you can submit a form with its name also.