lithium\tests\cases\util\SetTest::testExtractWithTypeCondition PHP Method

testExtractWithTypeCondition() public method

    public function testExtractWithTypeCondition()
    {
        $f = array(array('file' => array('name' => 'zipfile.zip', 'type' => 'application/zip', 'tmp_name' => '/tmp/php178.tmp', 'error' => 0, 'size' => '564647')), array('file' => array('name' => 'zipfile2.zip', 'type' => 'application/x-zip-compressed', 'tmp_name' => '/tmp/php179.tmp', 'error' => 0, 'size' => '354784')), array('file' => array('name' => 'picture.jpg', 'type' => 'image/jpeg', 'tmp_name' => '/tmp/php180.tmp', 'error' => 0, 'size' => '21324')));
        $expected = array(array('name' => 'zipfile2.zip', 'type' => 'application/x-zip-compressed', 'tmp_name' => '/tmp/php179.tmp', 'error' => 0, 'size' => '354784'));
        $result = Set::extract($f, '/file/.[type=application/x-zip-compressed]');
        $this->assertEqual($expected, $result);
        $expected = array(array('name' => 'zipfile.zip', 'type' => 'application/zip', 'tmp_name' => '/tmp/php178.tmp', 'error' => 0, 'size' => '564647'));
        $result = Set::extract($f, '/file/.[type=application/zip]');
        $this->assertEqual($expected, $result);
    }