lithium\tests\cases\util\StringTest::testStringExtraction PHP Method

testStringExtraction() public method

Tests the String::extract() regex helper method.
    public function testStringExtraction()
    {
        $result = String::extract('/string/', 'whole string');
        $this->assertEqual('string', $result);
        $this->assertFalse(String::extract('/not/', 'whole string'));
        $this->assertEqual('part', String::extract('/\\w+\\s*(\\w+)/', 'second part', 1));
        $this->assertNull(String::extract('/\\w+\\s*(\\w+)/', 'second part', 2));
    }