Annotation of embedaddon/php/ext/phar/tests/badparameters.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar: bad parameters to various methods
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("phar")) die("skip"); ?>
! 5: --INI--
! 6: phar.readonly=0
! 7: --FILE--
! 8: <?php
! 9: ini_set('phar.readonly', 1);
! 10: Phar::mungServer('hi');
! 11: Phar::createDefaultStub(array());
! 12: Phar::loadPhar(array());
! 13: Phar::canCompress('hi');
! 14: $a = new Phar(array());
! 15: $a = new Phar(dirname(__FILE__) . '/files/frontcontroller10.phar');
! 16: $a->convertToExecutable(array());
! 17: $a->convertToData(array());
! 18: $b = new PharData(dirname(__FILE__) . '/whatever.tar');
! 19: $c = new PharData(dirname(__FILE__) . '/whatever.zip');
! 20: $b->delete(array());
! 21: try {
! 22: $a->delete('oops');
! 23: } catch (Exception $e) {
! 24: echo $e->getMessage() . "\n";
! 25: }
! 26: try {
! 27: $b->delete('oops');
! 28: } catch (Exception $e) {
! 29: echo $e->getMessage() . "\n";
! 30: }
! 31: echo $a->getPath() . "\n";
! 32: try {
! 33: $a->setAlias('oops');
! 34: } catch (Exception $e) {
! 35: echo $e->getMessage() . "\n";
! 36: }
! 37: try {
! 38: $b->setAlias('oops');
! 39: } catch (Exception $e) {
! 40: echo $e->getMessage() . "\n";
! 41: }
! 42: ini_set('phar.readonly', 0);
! 43: $a->setAlias(array());
! 44: ini_set('phar.readonly', 1);
! 45: try {
! 46: $b->stopBuffering();
! 47: } catch (Exception $e) {
! 48: echo $e->getMessage() . "\n";
! 49: }
! 50: try {
! 51: $a->setStub('oops');
! 52: } catch (Exception $e) {
! 53: echo $e->getMessage() . "\n";
! 54: }
! 55: try {
! 56: $b->setStub('oops');
! 57: } catch (Exception $e) {
! 58: echo $e->getMessage() . "\n";
! 59: }
! 60: ini_set('phar.readonly', 0);
! 61: $a->setStub(array());
! 62: ini_set('phar.readonly', 1);
! 63: try {
! 64: $b->setDefaultStub('oops');
! 65: } catch (Exception $e) {
! 66: echo $e->getMessage() . "\n";
! 67: }
! 68: $a->setDefaultStub(array());
! 69: try {
! 70: $a->setDefaultStub('oops');
! 71: } catch (Exception $e) {
! 72: echo $e->getMessage() . "\n";
! 73: }
! 74: try {
! 75: $a->setSignatureAlgorithm(Phar::MD5);
! 76: } catch (Exception $e) {
! 77: echo $e->getMessage() . "\n";
! 78: }
! 79: $a->compress(array());
! 80: try {
! 81: $a->compress(1);
! 82: } catch (Exception $e) {
! 83: echo $e->getMessage() . "\n";
! 84: }
! 85: $a->compressFiles(array());
! 86: try {
! 87: $a->decompressFiles();
! 88: } catch (Exception $e) {
! 89: echo $e->getMessage() . "\n";
! 90: }
! 91: $a->copy(array());
! 92: try {
! 93: $a->copy('a', 'b');
! 94: } catch (Exception $e) {
! 95: echo $e->getMessage() . "\n";
! 96: }
! 97: $a->offsetExists(array());
! 98: $a->offsetGet(array());
! 99: ini_set('phar.readonly', 0);
! 100: $a->offsetSet(array());
! 101: ini_set('phar.readonly', 1);
! 102: $b->offsetUnset(array());
! 103: try {
! 104: $a->offsetUnset('a');
! 105: } catch (Exception $e) {
! 106: echo $e->getMessage() . "\n";
! 107: }
! 108: $a->addEmptyDir(array());
! 109: $a->addFile(array());
! 110: $a->addFromString(array());
! 111: try {
! 112: $a->setMetadata('a');
! 113: } catch (Exception $e) {
! 114: echo $e->getMessage() . "\n";
! 115: }
! 116: ini_set('phar.readonly', 0);
! 117: $a->setMetadata(1,2);
! 118: ini_set('phar.readonly', 1);
! 119: try {
! 120: $a->delMetadata();
! 121: } catch (Exception $e) {
! 122: echo $e->getMessage() . "\n";
! 123: }
! 124: ?>
! 125: ===DONE===
! 126: --EXPECTF--
! 127: Warning: Phar::mungServer() expects parameter 1 to be array, %string given in %sbadparameters.php on line %d
! 128:
! 129: Warning: Phar::createDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 130:
! 131: Warning: Phar::loadPhar() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 132:
! 133: Warning: Phar::canCompress() expects parameter 1 to be long, %string given in %sbadparameters.php on line %d
! 134:
! 135: Warning: Phar::__construct() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 136:
! 137: Warning: Phar::convertToExecutable() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
! 138:
! 139: Warning: Phar::convertToData() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
! 140:
! 141: Warning: PharData::delete() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 142: Cannot write out phar archive, phar is read-only
! 143: Entry oops does not exist and cannot be deleted
! 144: %sfiles/frontcontroller10.phar
! 145: Cannot write out phar archive, phar is read-only
! 146: A Phar alias cannot be set in a plain tar archive
! 147:
! 148: Warning: Phar::setAlias() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 149: Cannot change stub, phar is read-only
! 150: A Phar stub cannot be set in a plain tar archive
! 151:
! 152: Warning: Phar::setStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 153: A Phar stub cannot be set in a plain tar archive
! 154:
! 155: Warning: Phar::setDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 156: Cannot change stub: phar.readonly=1
! 157: Cannot set signature algorithm, phar is read-only
! 158:
! 159: Warning: Phar::compress() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
! 160: Cannot compress phar archive, phar is read-only
! 161:
! 162: Warning: Phar::compressFiles() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
! 163: Phar is readonly, cannot change compression
! 164:
! 165: Warning: Phar::copy() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
! 166: Cannot copy "a" to "b", phar is read-only
! 167:
! 168: Warning: Phar::offsetExists() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 169:
! 170: Warning: Phar::offsetGet() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 171:
! 172: Warning: Phar::offsetSet() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
! 173:
! 174: Warning: PharData::offsetUnset() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 175: Write operations disabled by the php.ini setting phar.readonly
! 176:
! 177: Warning: Phar::addEmptyDir() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 178:
! 179: Warning: Phar::addFile() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
! 180:
! 181: Warning: Phar::addFromString() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
! 182: Write operations disabled by the php.ini setting phar.readonly
! 183:
! 184: Warning: Phar::setMetadata() expects exactly 1 parameter, 2 given in %sbadparameters.php on line %d
! 185: Write operations disabled by the php.ini setting phar.readonly
! 186: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>