root/components/library/test/CorujaArrayManipulationTest.php

User picture

Author: Igor Moreno Santos

Revision: 262 («Previous)


File Size: 3.06 KB

(July 14, 2009 00:17 UTC) Almost 3 years ago

Adjusting some includes

 
Show/hide line numbers
<?php
require_once 'PHPUnit/Framework.php';

require_once dirname( __FILE__ ).'/../../../_start.php';

/**
 * Test class for CorujaArrayManipulation.
 * Generated by PHPUnit on 2008-10-24 at 21:41:40.
 */
class CorujaArrayManipulationTest extends PHPUnit_Framework_TestCase
{
    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     *
     * @access protected
     */
    protected function setUp()
    {
    }

    /**
     * Tears down the fixture, for example, closes a network connection.
     * This method is called after a test is executed.
     *
     * @access protected
     */
    protected function tearDown()
    {
    }

    /**
     * 
     */
    public function testGetArrayFieldWithNullArray() {

        // set up
        $array = null;

        // exercise
        $fieldValue = CorujaArrayManipulation::getArrayField( $array );

        // assert
        $this->assertNull( $fieldValue );
    }

    /**
     * @todo Implement testGetArrayField().
     */
    public function testGetArrayFieldWithNoKey() {

        // set up
        $array = array("one");

        // exercise
        $fieldValue = CorujaArrayManipulation::getArrayField( $array );

        // assert


        // Remove the following lines when you implement this test.
        $this->markTestIncomplete(
          'Behavior not defined yet.'
        );
    }

    /**
     * @todo Implement testGetArrayField().
     */
    public function testGetArrayFieldWithNoneArray() {

        // set up
        $integer = 2;

        // exercise
        $fieldValue = CorujaArrayManipulation::getArrayField( $integer, 0 );

        // assert


        // Remove the following lines when you implement this test.
        $this->markTestIncomplete(
          'Behavior not defined yet.'
        );
    }

    /**
     *
     */
    public function testGetArrayFieldWithExistingKey() {

        // set up
        $array = array("one");

        // exercise
        $fieldValue = CorujaArrayManipulation::getArrayField( $array, 0 );

        // assert
        $this->assertEquals( "one", $fieldValue );
    }

    /**
     *
     */
    public function testGetArrayFieldWithNoneExistingKey() {

        // set up
        $array = array("one");

        // exercise
        $fieldValue = CorujaArrayManipulation::getArrayField( $array, 2 );

        // assert
        $this->assertNull( $fieldValue );
    }

    /**
     *
     */
    public function testGetArrayFieldWithNoneExistingKeyAndThirdParameter() {

        // set up
        $array = array("one");

        // exercise
        $fieldValue = CorujaArrayManipulation::getArrayField( $array, 2, "anything" );

        // assert
        $this->assertEquals( "anything", $fieldValue );
    }

    /**
     *
     */
    public function testGetArrayFieldWithNullKey() {

        // set up
        $array = array("one");

        // exercise
        $fieldValue = CorujaArrayManipulation::getArrayField( $array, null, "anything" );

        // assert
        $this->assertEquals( "anything", $fieldValue );
    }


}
?>