root/components/library/test/CorujaStringManipulationTest.php

User picture

Author: Igor Moreno Santos

Revision: 262 («Previous)


File Size: 9.29 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 CorujaStringManipulation.
 * Generated by PHPUnit on 2008-10-28 at 14:52:27.
 */
class CorujaStringManipulationTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var    CorujaStringManipulation
     * @access protected
     */
    protected $object;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     *
     * @access protected
     */
    protected function setUp()
    {
        $this->object = new CorujaStringManipulation;
    }

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

    /**
     * Generated from @assert ("") == false.
     */
    public function testStrToBool()
    {
        $this->assertFalse(
          CorujaStringManipulation::strToBool("")
        );
    }

    /**
     * Generated from @assert ("false") == false.
     */
    public function testStrToBool2()
    {
        $this->assertFalse(
          CorujaStringManipulation::strToBool("false")
        );
    }

    /**
     * Generated from @assert ("FaLsE") == false.
     */
    public function testStrToBool3()
    {
        $this->assertFalse(
          CorujaStringManipulation::strToBool("FaLsE")
        );
    }

    /**
     * Generated from @assert ("0") == false.
     */
    public function testStrToBool4()
    {
        $this->assertFalse(
          CorujaStringManipulation::strToBool("0")
        );
    }

    /**
     * Generated from @assert ("a0a") == true.
     */
    public function testStrToBool5()
    {
        $this->assertTrue(
          CorujaStringManipulation::strToBool("a0a")
        );
    }

    /**
     * Generated from @assert ("true") == true.
     */
    public function testStrToBool6()
    {
        $this->assertTrue(
          CorujaStringManipulation::strToBool("true")
        );
    }

    /**
     * Generated from @assert ("1") == true.
     */
    public function testStrToBool7()
    {
        $this->assertTrue(
          CorujaStringManipulation::strToBool("1")
        );
    }

    /**
     * Generated from @assert (null) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testStrToBool8()
    {
        CorujaStringManipulation::strToBool(null);
    }

    /**
     * Generated from @assert (123) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testStrToBool9()
    {
        CorujaStringManipulation::strToBool(123);
    }

    /**
     * Generated from @assert (array()) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testStrToBool10()
    {
        CorujaStringManipulation::strToBool(array());
    }

    /**
     * Generated from @assert (new stdClass()) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testStrToBool11()
    {
        CorujaStringManipulation::strToBool(new stdClass());
    }

    /**
     * Generated from @assert (false) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testStrToBool12()
    {
        CorujaStringManipulation::strToBool(false);
    }

    /**
     * Generated from @assert ("a1b2c3d4") == 1234.
     */
    public function testForceInt()
    {
        $this->assertEquals(
          1234,
          CorujaStringManipulation::forceInt("a1b2c3d4")
        );
    }

    /**
     * Generated from @assert ("") == 0.
     */
    public function testForceInt2()
    {
        $this->assertEquals(
          0,
          CorujaStringManipulation::forceInt("")
        );
    }

    /**
     * Generated from @assert ("a0a") == 0.
     */
    public function testForceInt3()
    {
        $this->assertEquals(
          0,
          CorujaStringManipulation::forceInt("a0a")
        );
    }

    /**
     * Generated from @assert ("001") == 1.
     */
    public function testForceInt4()
    {
        $this->assertEquals(
          1,
          CorujaStringManipulation::forceInt("001")
        );
    }

    /**
     * Generated from @assert ("abc") == 0.
     */
    public function testForceInt5()
    {
        $this->assertEquals(
          0,
          CorujaStringManipulation::forceInt("abc")
        );
    }

    /**
     * Generated from @assert ("a-10") == 10.
     */
    public function testForceInt6()
    {
        $this->assertEquals(
          10,
          CorujaStringManipulation::forceInt("a-10")
        );
    }

    /**
     * Generated from @assert ("-10") == -10.
     */
    public function testForceInt7()
    {
        $this->assertEquals(
          -10,
          CorujaStringManipulation::forceInt("-10")
        );
    }

    /**
     * Generated from @assert ("--10") == -10.
     */
    public function testForceInt8()
    {
        $this->assertEquals(
          -10,
          CorujaStringManipulation::forceInt("--10")
        );
    }

    /**
     * Generated from @assert ("-a-b-1-0-") == -10.
     */
    public function testForceInt9()
    {
        $this->assertEquals(
          -10,
          CorujaStringManipulation::forceInt("-a-b-1-0-")
        );
    }

    /**
     * Generated from @assert (null) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testForceInt10()
    {
        CorujaStringManipulation::forceInt(null);
    }

    /**
     * Generated from @assert (123) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testForceInt11()
    {
        CorujaStringManipulation::forceInt(123);
    }

    /**
     * Generated from @assert (array()) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testForceInt12()
    {
        CorujaStringManipulation::forceInt(array());
    }

    /**
     * Generated from @assert (new stdClass()) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testForceInt13()
    {
        CorujaStringManipulation::forceInt(new stdClass());
    }

    /**
     * Generated from @assert (false) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testForceInt14()
    {
        CorujaStringManipulation::forceInt(false);
    }

    /**
     * Generated from @assert ("test") == "TEST".
     */
    public function testCamelCaseToUnderlineCase()
    {
        $this->assertEquals(
          "TEST",
          CorujaStringManipulation::camelCaseToUnderlineCase("test")
        );
    }

    /**
     * Generated from @assert ("somethingCool") == "SOMETHING_COOL".
     */
    public function testCamelCaseToUnderlineCase2()
    {
        $this->assertEquals(
          "SOMETHING_COOL",
          CorujaStringManipulation::camelCaseToUnderlineCase("somethingCool")
        );
    }

    /**
     * Generated from @assert ("") == "".
     */
    public function testCamelCaseToUnderlineCase3()
    {
        $this->assertEquals(
          "",
          CorujaStringManipulation::camelCaseToUnderlineCase("")
        );
    }

    /**
     * Generated from @assert ("1something2Cool3") == "1SOMETHING2_COOL3".
     */
    public function testCamelCaseToUnderlineCase4()
    {
        $this->assertEquals(
          "1SOMETHING2_COOL3",
          CorujaStringManipulation::camelCaseToUnderlineCase("1something2Cool3")
        );
    }

    /**
     * Generated from @assert ("111something2222Cool333") == "111SOMETHING2222_COOL333".
     */
    public function testCamelCaseToUnderlineCase5()
    {
        $this->assertEquals(
          "111SOMETHING2222_COOL333",
          CorujaStringManipulation::camelCaseToUnderlineCase("111something2222Cool333")
        );
    }

    /**
     * Generated from @assert (null) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testCamelCaseToUnderlineCase6()
    {
        CorujaStringManipulation::camelCaseToUnderlineCase(null);
    }

    /**
     * Generated from @assert (123) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testCamelCaseToUnderlineCase7()
    {
        CorujaStringManipulation::camelCaseToUnderlineCase(123);
    }

    /**
     * Generated from @assert (array()) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testCamelCaseToUnderlineCase8()
    {
        CorujaStringManipulation::camelCaseToUnderlineCase(array());
    }

    /**
     * Generated from @assert (new stdClass()) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testCamelCaseToUnderlineCase9()
    {
        CorujaStringManipulation::camelCaseToUnderlineCase(new stdClass());
    }

    /**
     * Generated from @assert (false) throws InvalidArgumentException.
     * @expectedException InvalidArgumentException
     */
    public function testCamelCaseToUnderlineCase10()
    {
        CorujaStringManipulation::camelCaseToUnderlineCase(false);
    }

}
?>