How to use stream_stat method of controller class

Best Atoum code snippet using controller.stream_stat

controller.php

Source:controller.php Github

copy

Full Screen

...19 ->string($controller->getContents())->isEmpty()20 ->integer($controller->getPointer())->isZero()21 ->integer($controller->getPermissions())->isEqualTo(644)22 ->boolean($controller->stream_eof())->isFalse()23 ->array($controller->stream_stat())->isNotEmpty()24 ;25 }26 public function test__set()27 {28 $this29 ->if($controller = new testedClass(uniqid()))30 ->and($controller->stream_open = false)31 ->then32 ->boolean($controller->stream_open(uniqid(), 'r', uniqid()))->isFalse()33 ->exception(function() use ($controller) { $controller->mkdir = true; })34 ->isInstanceOf('mageekguy\atoum\exceptions\logic\invalidArgument')35 ->hasMessage('Unable to override streamWrapper::mkdir() for file')36 ;37 }38 public function testDuplicate()39 {40 $this41 ->if($controller = new testedClass(uniqid()))42 ->then43 ->object($duplicatedController = $controller->duplicate())->isEqualTo($controller)44 ->if($controller->setPath($path = uniqid()))45 ->then46 ->string($duplicatedController->getPath())->isEqualTo($path)47 ->if($controller->stream_lock(LOCK_SH))48 ->then49 ->array($duplicatedController->getCalls())->isEqualTo($controller->getCalls())50 ->if($controller->stream_lock = function() {})51 ->then52 ->array($duplicatedController->getInvokers())->isEqualTo($controller->getInvokers())53 ->if($controller->setContents(uniqid()))54 ->then55 ->string($duplicatedController->getContents())->isEqualTo($controller->getContents())56 ->if($controller->isNotReadable())57 ->and($controller->isNotWritable())58 ->and($controller->isNotExecutable())59 ->then60 ->integer($duplicatedController->getPermissions())->isEqualTo($controller->getPermissions())61 ->if($controller->notExists())62 ->then63 ->boolean($duplicatedController->stream_stat())->isEqualTo($controller->stream_stat())64 ;65 }66 public function testContains()67 {68 $this69 ->if($controller = new testedClass(uniqid()))70 ->then71 ->object($controller->contains('abcdefghijklmnopqrstuvwxyz'))->isIdenticalTo($controller)72 ->if($controller->stream_open(uniqid(), 'r', 0))73 ->then74 ->string($controller->stream_read(1))->isEqualTo('a')75 ->boolean($controller->stream_eof())->isFalse()76 ->string($controller->stream_read(1))->isEqualTo('b')77 ->boolean($controller->stream_eof())->isFalse()78 ->string($controller->stream_read(2))->isEqualTo('cd')79 ->boolean($controller->stream_eof())->isFalse()80 ->string($controller->stream_read(4096))->isEqualTo('efghijklmnopqrstuvwxyz')81 ->boolean($controller->stream_eof())->isFalse()82 ->string($controller->stream_read(1))->isEmpty()83 ->boolean($controller->stream_eof())->isTrue()84 ;85 }86 public function testIsEmpty()87 {88 $this89 ->if($controller = new testedClass(uniqid()))90 ->and($controller->contains('abcdefghijklmnopqrstuvwxyz'))91 ->then92 ->object($controller->isEmpty())->isIdenticalTo($controller)93 ->string($controller->getContents())->isEmpty()94 ;95 }96 public function testExists()97 {98 $this99 ->if($controller = new testedClass(uniqid()))100 ->then101 ->object($controller->exists())->isIdenticalTo($controller)102 ->array($controller->stream_stat())->isNotEmpty()103 ->if($controller->notExists())104 ->then105 ->object($controller->exists())->isIdenticalTo($controller)106 ->array($controller->stream_stat())->isNotEmpty()107 ;108 }109 public function testNotExists()110 {111 $this112 ->if($controller = new testedClass(uniqid()))113 ->then114 ->object($controller->notExists())->isIdenticalTo($controller)115 ->boolean($controller->stream_stat())->isFalse()116 ;117 }118 public function testIsNotReadable()119 {120 $this121 ->if($controller = new testedClass(uniqid()))122 ->then123 ->object($controller->isNotReadable())->isIdenticalTo($controller)124 ->integer($controller->getPermissions())->isEqualTo(200)125 ->object($controller->isNotReadable())->isIdenticalTo($controller)126 ->integer($controller->getPermissions())->isEqualTo(200)127 ;128 }129 public function testIsReadable()130 {131 $this132 ->if($controller = new testedClass(uniqid()))133 ->then134 ->object($controller->isReadable())->isIdenticalTo($controller)135 ->integer($controller->getPermissions())->isEqualTo(644)136 ->object($controller->isReadable())->isIdenticalTo($controller)137 ->integer($controller->getPermissions())->isEqualTo(644)138 ->if($controller->isNotReadable())139 ->then140 ->object($controller->isReadable())->isIdenticalTo($controller)141 ->integer($controller->getPermissions())->isEqualTo(644)142 ->object($controller->isReadable())->isIdenticalTo($controller)143 ->integer($controller->getPermissions())->isEqualTo(644)144 ;145 }146 public function testIsNotWritable()147 {148 $this149 ->if($controller = new testedClass(uniqid()))150 ->then151 ->object($controller->isNotWritable())->isIdenticalTo($controller)152 ->integer($controller->getPermissions())->isEqualTo(444)153 ->object($controller->isNotWritable())->isIdenticalTo($controller)154 ->integer($controller->getPermissions())->isEqualTo(444)155 ;156 }157 public function testIsWritable()158 {159 $this160 ->if($controller = new testedClass(uniqid()))161 ->and($controller->isNotWritable())162 ->then163 ->object($controller->isWritable())->isIdenticalTo($controller)164 ->integer($controller->getPermissions())->isEqualTo(666)165 ->object($controller->isWritable())->isIdenticalTo($controller)166 ->integer($controller->getPermissions())->isEqualTo(666)167 ;168 }169 public function testIsExecutable()170 {171 $this172 ->if($controller = new testedClass(uniqid()))173 ->then174 ->object($controller->isExecutable())->isIdenticalTo($controller)175 ->integer($controller->getPermissions())->isEqualTo(755)176 ->object($controller->isExecutable())->isIdenticalTo($controller)177 ->integer($controller->getPermissions())->isEqualTo(755)178 ;179 }180 public function testIsNotExecutable()181 {182 $this183 ->if($controller = new testedClass(uniqid()))184 ->and($controller->isExecutable())185 ->then186 ->object($controller->isNotExecutable())->isIdenticalTo($controller)187 ->integer($controller->getPermissions())->isEqualTo(644)188 ->object($controller->isNotExecutable())->isIdenticalTo($controller)189 ->integer($controller->getPermissions())->isEqualTo(644)190 ;191 }192 public function testStreamOpen()193 {194 $this195 ->assert('Use r and r+ mode')196 ->if($controller = new testedClass(uniqid()))197 ->then198 ->boolean($controller->stream_open(uniqid(), 'z', 0))->isFalse()199 ->array($controller->getCalls())->isNotEmpty()200 ->boolean($controller->stream_open(uniqid(), 'z', STREAM_REPORT_ERRORS))->isFalse()201 ->error('Operation timed out', E_USER_WARNING)->exists()202 ->boolean($controller->stream_open(uniqid(), 'r', 0))->isTrue()203 ->integer($controller->stream_tell())->isZero()204 ->string($controller->stream_read(1))->isEmpty()205 ->integer($controller->stream_write('a'))->isZero()206 ->boolean($controller->stream_open(uniqid(), 'r+', 0))->isTrue()207 ->integer($controller->stream_tell())->isZero()208 ->string($controller->stream_read(1))->isEmpty()209 ->integer($controller->stream_write('a'))->isEqualTo(1)210 ->boolean($controller->stream_open(uniqid(), 'r', STREAM_USE_PATH, $path))->isTrue()211 ->string($path)->isEqualTo($controller->getPath())212 ->boolean($controller->stream_open(uniqid(), 'r+', STREAM_USE_PATH, $path))->isTrue()213 ->string($path)->isEqualTo($controller->getPath())214 ->if($controller->setContents('abcdefghijklmnopqrstuvwxyz'))215 ->then216 ->boolean($controller->stream_open(uniqid(), 'r', 0))->isTrue()217 ->array($controller->getCalls())->isNotEmpty()218 ->integer($controller->stream_tell())->isZero()219 ->string($controller->stream_read(1))->isEqualTo('a')220 ->integer($controller->stream_write('a'))->isZero()221 ->boolean($controller->stream_open(uniqid(), 'r+', 0))->isTrue()222 ->integer($controller->stream_tell())->isZero()223 ->string($controller->stream_read(1))->isEqualTo('a')224 ->integer($controller->stream_write('a'))->isEqualTo(1)225 ->boolean($controller->stream_open(uniqid(), 'r', STREAM_USE_PATH, $path))->isTrue()226 ->string($path)->isEqualTo($controller->getPath())227 ->boolean($controller->stream_open(uniqid(), 'r+', STREAM_USE_PATH, $path))->isTrue()228 ->string($path)->isEqualTo($controller->getPath())229 ->if($controller->notExists())230 ->then231 ->boolean($controller->stream_open(uniqid(), 'r', 0))->isFalse()232 ->array($controller->getCalls())->isNotEmpty()233 ->boolean($controller->stream_open(uniqid(), 'r+', 0))->isFalse()234 ->boolean($controller->stream_open(uniqid(), 'r', STREAM_REPORT_ERRORS))->isFalse()235 ->error('No such file or directory', E_USER_WARNING)->exists()236 ->boolean($controller->stream_open(uniqid(), 'r+', STREAM_REPORT_ERRORS))->isFalse()237 ->error('No such file or directory', E_USER_WARNING)->exists()238 ->boolean($controller->stream_open(uniqid(), 'r+', 0))->isFalse()239 ->boolean($controller->stream_open(uniqid(), 'r', STREAM_USE_PATH, $path))->isFalse()240 ->variable($path)->isNull()241 ->boolean($controller->stream_open(uniqid(), 'r+', STREAM_USE_PATH, $path))->isFalse()242 ->variable($path)->isNull()243 ->if($controller->exists())244 ->and($controller->isNotReadable())245 ->then246 ->boolean($controller->stream_open(uniqid(), 'r', 0))->isFalse()247 ->array($controller->getCalls())->isNotEmpty()248 ->boolean($controller->stream_open(uniqid(), 'r+', 0))->isFalse()249 ->boolean($controller->stream_open(uniqid(), 'r', STREAM_REPORT_ERRORS))->isFalse()250 ->error('Permission denied', E_USER_WARNING)->exists()251 ->boolean($controller->stream_open(uniqid(), 'r+', STREAM_REPORT_ERRORS))->isFalse()252 ->error('Permission denied', E_USER_WARNING)->exists()253 ->boolean($controller->stream_open(uniqid(), 'r', STREAM_USE_PATH, $path))->isFalse()254 ->variable($path)->isNull()255 ->boolean($controller->stream_open(uniqid(), 'r+', STREAM_USE_PATH, $path))->isFalse()256 ->variable($path)->isNull()257 ->if($controller->isReadable())258 ->and($controller->isNotWritable())259 ->boolean($controller->stream_open(uniqid(), 'r', 0))->isTrue()260 ->array($controller->getCalls())->isNotEmpty()261 ->boolean($controller->stream_open(uniqid(), 'r+', 0))->isFalse()262 ->boolean($controller->stream_open(uniqid(), 'r+', STREAM_REPORT_ERRORS))->isFalse()263 ->error('Permission denied', E_USER_WARNING)->exists()264 ->boolean($controller->stream_open(uniqid(), 'r', STREAM_USE_PATH, $path))->isTrue()265 ->string($path)->isEqualTo($controller->getPath())266 ->boolean($controller->stream_open(uniqid(), 'r+', STREAM_USE_PATH, $path))->isFalse()267 ->variable($path)->isNull()268 ->assert('Use w and w+ mode')269 ->if($controller = new testedClass(uniqid()))270 ->then271 ->boolean($controller->stream_open(uniqid(), 'w', 0))->isTrue()272 ->array($controller->getCalls())->isNotEmpty()273 ->integer($controller->stream_tell())->isZero()274 ->string($controller->stream_read(1))->isEmpty()275 ->integer($controller->stream_write('a'))->isEqualTo(1)276 ->boolean($controller->stream_open(uniqid(), 'w+', 0))->isTrue()277 ->integer($controller->stream_tell())->isZero()278 ->string($controller->stream_read(1))->isEmpty()279 ->integer($controller->stream_write('a'))->isEqualTo(1)280 ->boolean($controller->stream_open(uniqid(), 'w', STREAM_USE_PATH, $path))->isTrue()281 ->string($path)->isEqualTo($controller->getPath())282 ->boolean($controller->stream_open(uniqid(), 'w+', STREAM_USE_PATH, $path))->isTrue()283 ->string($path)->isEqualTo($controller->getPath())284 ->if($controller->setContents('abcdefghijklmnopqrstuvwxyz'))285 ->then286 ->boolean($controller->stream_open(uniqid(), 'w', 0))->isTrue()287 ->array($controller->getCalls())->isNotEmpty()288 ->integer($controller->stream_tell())->isZero()289 ->string($controller->stream_read(1))->isEmpty()290 ->integer($controller->stream_write('a'))->isEqualTo(1)291 ->boolean($controller->stream_open(uniqid(), 'w+', 0))->isTrue()292 ->integer($controller->stream_tell())->isZero()293 ->string($controller->stream_read(1))->isEmpty()294 ->integer($controller->stream_write('a'))->isEqualTo(1)295 ->if($controller->notExists())296 ->then297 ->boolean($controller->stream_open(uniqid(), 'w', 0))->isTrue()298 ->integer($controller->getPermissions())->isEqualTo(644)299 ->if($controller->notExists())300 ->then301 ->boolean($controller->stream_open(uniqid(), 'w+', 0))->isTrue()302 ->integer($controller->getPermissions())->isEqualTo(644)303 ->if($controller->exists())304 ->and($controller->isNotWritable())305 ->then306 ->boolean($controller->stream_open(uniqid(), 'w', 0))->isFalse()307 ->array($controller->getCalls())->isNotEmpty()308 ->boolean($controller->stream_open(uniqid(), 'w', STREAM_REPORT_ERRORS))->isFalse()309 ->error('Permission denied', E_USER_WARNING)->exists()310 ->boolean($controller->stream_open(uniqid(), 'w+', 0))->isFalse()311 ->boolean($controller->stream_open(uniqid(), 'w+', STREAM_REPORT_ERRORS))->isFalse()312 ->error('Permission denied', E_USER_WARNING)->exists()313 ->assert('Use c and c+ mode')314 ->if($controller = new testedClass(uniqid()))315 ->then316 ->boolean($controller->stream_open(uniqid(), 'c', 0))->isTrue()317 ->array($controller->getCalls())->isNotEmpty()318 ->integer($controller->stream_tell())->isZero()319 ->string($controller->stream_read(1))->isEmpty()320 ->integer($controller->stream_write('a'))->isEqualTo(1)321 ->boolean($controller->stream_open(uniqid(), 'c+', 0))->isTrue()322 ->integer($controller->stream_tell())->isZero()323 ->string($controller->stream_read(1))->isEqualTo('a')324 ->integer($controller->stream_write('a'))->isEqualTo(1)325 ->boolean($controller->stream_open(uniqid(), 'c', STREAM_USE_PATH, $path))->isTrue()326 ->string($path)->isEqualTo($controller->getPath())327 ->boolean($controller->stream_open(uniqid(), 'c+', STREAM_USE_PATH, $path))->isTrue()328 ->string($path)->isEqualTo($controller->getPath())329 ->if($controller->setContents('abcdefghijklmnopqrstuvwxyz'))330 ->then331 ->boolean($controller->stream_open(uniqid(), 'c', 0))->isTrue()332 ->array($controller->getCalls())->isNotEmpty()333 ->integer($controller->stream_tell())->isZero()334 ->string($controller->stream_read(1))->isEmpty()335 ->integer($controller->stream_write('a'))->isEqualTo(1)336 ->boolean($controller->stream_open(uniqid(), 'c+', 0))->isTrue()337 ->integer($controller->stream_tell())->isZero()338 ->string($controller->stream_read(1))->isEqualTo('a')339 ->integer($controller->stream_write('a'))->isEqualTo(1)340 ->if($controller->notExists())341 ->then342 ->boolean($controller->stream_open(uniqid(), 'c', 0))->isTrue()343 ->integer($controller->getPermissions())->isEqualTo(644)344 ->if($controller->notExists())345 ->then346 ->boolean($controller->stream_open(uniqid(), 'c+', 0))->isTrue()347 ->integer($controller->getPermissions())->isEqualTo(644)348 ->if($controller->exists())349 ->and($controller->isNotWritable())350 ->then351 ->boolean($controller->stream_open(uniqid(), 'c', 0))->isFalse()352 ->array($controller->getCalls())->isNotEmpty()353 ->boolean($controller->stream_open(uniqid(), 'c', STREAM_REPORT_ERRORS))->isFalse()354 ->error('Permission denied', E_USER_WARNING)->exists()355 ->boolean($controller->stream_open(uniqid(), 'c+', 0))->isFalse()356 ->boolean($controller->stream_open(uniqid(), 'c+', STREAM_REPORT_ERRORS))->isFalse()357 ->error('Permission denied', E_USER_WARNING)->exists()358 ->assert('Use a and a+ mode')359 ->if($controller = new testedClass(uniqid()))360 ->then361 ->boolean($controller->stream_open(uniqid(), 'a', 0))->isTrue()362 ->array($controller->getCalls())->isNotEmpty()363 ->integer($controller->stream_tell())->isZero()364 ->string($controller->stream_read(1))->isEmpty()365 ->integer($controller->stream_write('a'))->isEqualTo(1)366 ->string($controller->getContents())->isEqualTo('a')367 ->integer($controller->stream_write('b'))->isEqualTo(1)368 ->string($controller->getContents())->isEqualTo('ab')369 ->boolean($controller->stream_open(uniqid(), 'a', 0))->isTrue()370 ->integer($controller->stream_tell())->isZero()371 ->string($controller->stream_read(1))->isEmpty()372 ->integer($controller->stream_write('c'))->isEqualTo(1)373 ->string($controller->getContents())->isEqualTo('ab' . PHP_EOL . 'c')374 ->integer($controller->stream_write('d'))->isEqualTo(1)375 ->string($controller->getContents())->isEqualTo('ab' . PHP_EOL . 'cd')376 ->boolean($controller->stream_open(uniqid(), 'a+', 0))->isTrue()377 ->integer($controller->stream_tell())->isZero()378 ->string($controller->stream_read(1))->isEqualTo('a')379 ->integer($controller->stream_write('e'))->isEqualTo(1)380 ->string($controller->getContents())->isEqualTo('ab' . PHP_EOL . 'cd' . PHP_EOL . 'e')381 ->if($controller->setContents('abcdefghijklmnopqrstuvwxyz'))382 ->then383 ->boolean($controller->stream_open(uniqid(), 'a', 0))->isTrue()384 ->array($controller->getCalls())->isNotEmpty()385 ->integer($controller->stream_tell())->isZero()386 ->string($controller->stream_read(1))->isEmpty()387 ->integer($controller->stream_write('A'))->isEqualTo(1)388 ->string($controller->getContents())->isEqualTo('abcdefghijklmnopqrstuvwxyz' . PHP_EOL . 'A')389 ->boolean($controller->stream_open(uniqid(), 'a+', 0))->isTrue()390 ->array($controller->getCalls())->isNotEmpty()391 ->integer($controller->stream_tell())->isZero()392 ->string($controller->stream_read(1))->isEqualTo('a')393 ->integer($controller->stream_write('B'))->isEqualTo(1)394 ->string($controller->getContents())->isEqualTo('abcdefghijklmnopqrstuvwxyz' . PHP_EOL . 'A' . PHP_EOL . 'B')395 ->integer($controller->stream_write('C'))->isEqualTo(1)396 ->string($controller->getContents())->isEqualTo('abcdefghijklmnopqrstuvwxyz' . PHP_EOL . 'A' . PHP_EOL . 'BC')397 ->if($controller->notExists())398 ->then399 ->boolean($controller->stream_open(uniqid(), 'a', 0))->isTrue()400 ->integer($controller->getPermissions())->isEqualTo(644)401 ->if($controller->notExists())402 ->then403 ->boolean($controller->stream_open(uniqid(), 'a+', 0))->isTrue()404 ->integer($controller->getPermissions())->isEqualTo(644)405 ->if($controller->exists())406 ->and($controller->isNotWritable())407 ->then408 ->boolean($controller->stream_open(uniqid(), 'a', 0))->isFalse()409 ->array($controller->getCalls())->isNotEmpty()410 ->boolean($controller->stream_open(uniqid(), 'a+', 0))->isFalse()411 ->if($controller = new testedClass(uniqid()))412 ->if($controller->isWritable())413 ->and($controller->isNotReadable())414 ->then415 ->boolean($controller->stream_open(uniqid(), 'a', 0))->isTrue()416 ->array($controller->getCalls())->isNotEmpty()417 ->boolean($controller->stream_open(uniqid(), 'a+', 0))->isFalse()418 ->boolean($controller->stream_open(uniqid(), 'a+', STREAM_REPORT_ERRORS))->isFalse()419 ->error('Permission denied', E_USER_WARNING)->exists()420 ->assert('Use x and x+ mode')421 ->if($controller = new testedClass(uniqid()))422 ->then423 ->boolean($controller->stream_open(uniqid(), 'x', 0))->isFalse()424 ->array($controller->getCalls())->isNotEmpty()425 ->boolean($controller->stream_open(uniqid(), 'x', STREAM_REPORT_ERRORS))->isFalse()426 ->error('File exists', E_USER_WARNING)->exists()427 ->boolean($controller->stream_open(uniqid(), 'x+', 0))->isFalse()428 ->boolean($controller->stream_open(uniqid(), 'x+', STREAM_REPORT_ERRORS))->isFalse()429 ->error('File exists', E_USER_WARNING)->exists()430 ->if($controller->notExists())431 ->then432 ->boolean($controller->stream_open(uniqid(), 'x', 0))->isTrue()433 ->array($controller->getCalls())->isNotEmpty()434 ->integer($controller->stream_tell())->isZero()435 ->string($controller->stream_read(1))->isEmpty()436 ->integer($controller->stream_write('a'))->isEqualTo(0)437 ->boolean($controller->stream_open(uniqid(), 'x+', 0))->isTrue()438 ->integer($controller->stream_tell())->isZero()439 ->string($controller->stream_read(1))->isEmpty()440 ->integer($controller->stream_write('a'))->isEqualTo(1)441 ->if($controller->setContents('abcdefghijklmnopqrstuvwxyz'))442 ->then443 ->boolean($controller->stream_open(uniqid(), 'x', 0))->isTrue()444 ->array($controller->getCalls())->isNotEmpty()445 ->integer($controller->stream_tell())->isZero()446 ->string($controller->stream_read(1))->isEqualTo('a')447 ->integer($controller->stream_write('a'))->isEqualTo(0)448 ->boolean($controller->stream_open(uniqid(), 'x+', 0))->isTrue()449 ->integer($controller->stream_tell())->isZero()450 ->string($controller->stream_read(1))->isEqualTo('a')451 ->integer($controller->stream_write('a'))->isEqualTo(1)452 ->if($controller->isNotReadable())453 ->then454 ->boolean($controller->stream_open(uniqid(), 'x', 0))->isFalse()455 ->array($controller->getCalls())->isNotEmpty()456 ->boolean($controller->stream_open(uniqid(), 'x', STREAM_REPORT_ERRORS))->isFalse()457 ->error('Permission denied', E_USER_WARNING)->exists()458 ->boolean($controller->stream_open(uniqid(), 'x+', 0))->isFalse()459 ->boolean($controller->stream_open(uniqid(), 'x+', STREAM_REPORT_ERRORS))->isFalse()460 ->error('Permission denied', E_USER_WARNING)->exists()461 ->if($controller->isReadable())462 ->and($controller->isNotWritable())463 ->then464 ->boolean($controller->stream_open(uniqid(), 'x', 0))->isTrue()465 ->array($controller->getCalls())->isNotEmpty()466 ->boolean($controller->stream_open(uniqid(), 'x+', 0))->isFalse()467 ->boolean($controller->stream_open(uniqid(), 'x+', STREAM_REPORT_ERRORS))->isFalse()468 ->error('Permission denied', E_USER_WARNING)->exists()469 ->if($controller->stream_open = false)470 ->then471 ->boolean($controller->stream_open(uniqid(), 'x', 0))->isFalse()472 ->boolean($controller->stream_open(uniqid(), 'x+', 0))->isFalse()473 ->boolean($controller->stream_open(uniqid(), 'x+', STREAM_REPORT_ERRORS))->isFalse()474 ->error('Permission denied', E_USER_WARNING)->notExists()475 ;476 }477 public function testStreamSeek()478 {479 $this480 ->if($controller = new testedClass(uniqid()))481 ->then482 ->boolean($controller->stream_seek(0))->isTrue()483 ->boolean($controller->stream_seek(1))->isTrue()484 ->if($controller->contains('abcdefghijklmnopqrstuvwxyz'))485 ->and($controller->stream_open(uniqid(), 'r', 0))486 ->then487 ->boolean($controller->stream_seek(0))->isTrue()488 ->boolean($controller->stream_seek(1))->isTrue()489 ->string($controller->stream_read(1))->isEqualTo('b')490 ->boolean($controller->stream_seek(25))->isTrue()491 ->string($controller->stream_read(1))->isEqualTo('z')492 ->boolean($controller->stream_seek(26))->isTrue()493 ->string($controller->stream_read(1))->isEmpty()494 ->boolean($controller->stream_seek(0))->isTrue()495 ->string($controller->stream_read(1))->isEqualTo('a')496 ->boolean($controller->stream_seek(-1, SEEK_END))->isTrue()497 ->string($controller->stream_read(1))->isEqualTo('z')498 ->boolean($controller->stream_seek(-26, SEEK_END))->isTrue()499 ->string($controller->stream_read(1))->isEqualTo('a')500 ->boolean($controller->stream_seek(-27, SEEK_END))->isTrue()501 ->string($controller->stream_read(1))->isEmpty()502 ->if($controller = new testedClass(uniqid()))503 ->and($controller->contains('abcdefghijklmnopqrstuvwxyz'))504 ->and($controller->stream_open(uniqid(), 'r', 0))505 ->and($controller->stream_read(4096))506 ->then507 ->boolean($controller->stream_eof())->isFalse()508 ->if($controller->stream_read(4096))509 ->then510 ->boolean($controller->stream_eof())->isTrue()511 ->boolean($controller->stream_seek(0))->isTrue()512 ->boolean($controller->stream_eof())->isFalse()513 ;514 }515 public function testStreamEof()516 {517 $this518 ->if($controller = new testedClass(uniqid()))519 ->then520 ->boolean($controller->stream_eof())->isFalse()521 ->if($controller->contains('abcdefghijklmnopqrstuvwxyz'))522 ->then523 ->boolean($controller->stream_eof())->isFalse()524 ->if($controller->stream_seek(26))525 ->then526 ->boolean($controller->stream_eof())->isFalse()527 ->if($controller->stream_seek(27))528 ->then529 ->boolean($controller->stream_eof())->isFalse()530 ->if($controller->stream_open(uniqid(), 'r', 0))531 ->and($controller->stream_seek(27))532 ->and($controller->stream_read(1))533 ->then534 ->boolean($controller->stream_eof())->isTrue()535 ;536 }537 public function testStreamTell()538 {539 $this540 ->if($controller = new testedClass(uniqid()))541 ->then542 ->integer($controller->stream_tell())->isZero()543 ->if($controller->stream_seek($offset = rand(1, 4096)))544 ->then545 ->integer($controller->stream_tell())->isEqualTo($offset)546 ;547 }548 public function testStreamRead()549 {550 $this551 ->if($controller = new testedClass(uniqid()))552 ->and($controller->stream_open(uniqid(), 'r', 0))553 ->then554 ->string($controller->stream_read(1))->isEmpty()555 ->boolean($controller->stream_eof())->isTrue()556 ->if($controller->contains('abcdefghijklmnopqrstuvwxyz'))557 ->then558 ->string($controller->stream_read(1))->isEqualTo('a')559 ->boolean($controller->stream_eof())->isFalse()560 ->if($controller->stream_seek(6))561 ->then562 ->string($controller->stream_read(1))->isEqualTo('g')563 ->string($controller->stream_read(4096))->isEqualTo('hijklmnopqrstuvwxyz')564 ->boolean($controller->stream_eof())->isFalse()565 ->string($controller->stream_read(1))->isEmpty()566 ->boolean($controller->stream_eof())->isTrue()567 ;568 }569 public function testStreamWrite()570 {571 $this572 ->if($controller = new testedClass(uniqid()))573 ->then574 ->integer($controller->stream_write('a'))->isZero()575 ->integer($controller->stream_tell())->isZero()576 ->if($controller->stream_open(uniqid(), 'r', 0))577 ->then578 ->integer($controller->stream_write('a'))->isZero()579 ->integer($controller->stream_tell())->isZero()580 ->if($controller->stream_open(uniqid(), 'w', 0))581 ->then582 ->integer($controller->stream_write('a'))->isEqualTo(1)583 ->integer($controller->stream_tell())->isEqualTo(1)584 ->integer($controller->stream_write('bcdefghijklmnopqrstuvwxyz'))->isEqualTo(25)585 ->integer($controller->stream_tell())->isEqualTo(26)586 ;587 }588 /** @php 5.4 */589 public function testStreamMetadata()590 {591 $this592 ->if($controller = new testedClass(uniqid()))593 ->then594 ->boolean($controller->stream_metadata(uniqid(), STREAM_META_ACCESS, 755))->isTrue()595 ->integer($controller->getPermissions())->isEqualTo(755)596 ;597 }598 public function testStreamStat()599 {600 $this601 ->if($controller = new testedClass(uniqid()))602 ->and($stats = array(603 'dev' => 0,604 'ino' => 0,605 'mode' => 33188,606 'nlink' => 0,607 'uid' => getmyuid(),608 'gid' => getmygid(),609 'rdev' => 0,610 'size' => 0,611 'atime' => 507769200,612 'mtime' => 507769200,613 'ctime' => 507769200,614 'blksize' => 0,615 'blocks' => 0,616 )617 )618 ->and($stats[0] = & $stats['dev'])619 ->and($stats[1] = & $stats['ino'])620 ->and($stats[2] = & $stats['mode'])621 ->and($stats[3] = & $stats['nlink'])622 ->and($stats[4] = & $stats['uid'])623 ->and($stats[5] = & $stats['gid'])624 ->and($stats[6] = & $stats['rdev'])625 ->and($stats[7] = & $stats['size'])626 ->and($stats[8] = & $stats['atime'])627 ->and($stats[9] = & $stats['mtime'])628 ->and($stats[10] = & $stats['ctime'])629 ->and($stats[11] = & $stats['blksize'])630 ->and($stats[12] = & $stats['blocks'])631 ->then632 ->array($controller->stream_stat())->isEqualTo($stats)633 ->if($controller->notExists())634 ->then635 ->boolean($controller->stream_stat())->isFalse()636 ->if($controller = new testedClass(uniqid()))637 ->and($controller->stream_stat[2] = false)638 ->then639 ->array($controller->stream_stat())->isNotEmpty()640 ->boolean($controller->stream_stat())->isFalse()641 ->array($controller->stream_stat())->isNotEmpty()642 ;643 }644 public function testStreamTruncate()645 {646 $this647 ->if($controller = new testedClass(uniqid()))648 ->then649 ->boolean($controller->stream_truncate(0))->isTrue()650 ->string($controller->getContents())->isEmpty()651 ->boolean($controller->stream_truncate($size = rand(1, 10)))->isTrue()652 ->string($controller->getContents())->isEqualTo(str_repeat("\0", $size))653 ->boolean($controller->stream_truncate(0))->isTrue()654 ->string($controller->getContents())->isEmpty()655 ->boolean($controller->stream_truncate($size = rand(5, 10)))->isTrue()656 ->string($controller->getContents())->isEqualTo(str_repeat("\0", $size))657 ->boolean($controller->stream_truncate(4))->isTrue()658 ->string($controller->getContents())->isEqualTo("\0\0\0\0")659 ;660 }661 public function testStreamLock()662 {663 $this664 ->if($controller = new testedClass(uniqid()))665 ->then666 ->boolean($controller->stream_lock(LOCK_SH))->isTrue()667 ->boolean($controller->stream_lock(LOCK_EX))->isTrue()668 ->boolean($controller->stream_lock(LOCK_UN))->isTrue()669 ->boolean($controller->stream_lock(LOCK_SH | LOCK_NB))->isTrue()670 ->boolean($controller->stream_lock(LOCK_EX | LOCK_NB))->isTrue()671 ->if($controller->stream_lock = false)672 ->then673 ->boolean($controller->stream_lock(LOCK_SH))->isFalse()674 ->boolean($controller->stream_lock(LOCK_EX))->isFalse()675 ->boolean($controller->stream_lock(LOCK_UN))->isFalse()676 ->boolean($controller->stream_lock(LOCK_SH | LOCK_NB))->isFalse()677 ->boolean($controller->stream_lock(LOCK_EX | LOCK_NB))->isFalse()678 ;679 }680 public function testStreamClose()681 {682 $this683 ->if($controller = new testedClass(uniqid()))684 ->then685 ->boolean($controller->stream_close())->isTrue()686 ->if($controller->stream_close = false)687 ->then688 ->boolean($controller->stream_close())->isFalse()689 ;690 }691 public function testUrlStat()692 {693 $this694 ->if($controller = new testedClass(uniqid()))695 ->and($stats = array(696 'dev' => 0,697 'ino' => 0,698 'mode' => 33188,699 'nlink' => 0,700 'uid' => getmyuid(),701 'gid' => getmygid(),702 'rdev' => 0,703 'size' => 0,704 'atime' => 507769200,705 'mtime' => 507769200,706 'ctime' => 507769200,707 'blksize' => 0,708 'blocks' => 0,709 )710 )711 ->and($stats[0] = & $stats['dev'])712 ->and($stats[1] = & $stats['ino'])713 ->and($stats[2] = & $stats['mode'])714 ->and($stats[3] = & $stats['nlink'])715 ->and($stats[4] = & $stats['uid'])716 ->and($stats[5] = & $stats['gid'])717 ->and($stats[6] = & $stats['rdev'])718 ->and($stats[7] = & $stats['size'])719 ->and($stats[8] = & $stats['atime'])720 ->and($stats[9] = & $stats['mtime'])721 ->and($stats[10] = & $stats['ctime'])722 ->and($stats[11] = & $stats['blksize'])723 ->and($stats[12] = & $stats['blocks'])724 ->then725 ->array($controller->url_stat(uniqid(), STREAM_URL_STAT_QUIET))->isEqualTo($stats)726 ->if($controller->notExists())727 ->then728 ->boolean($controller->url_stat(uniqid(), STREAM_URL_STAT_QUIET))->isFalse()729 ->if($controller = new testedClass(uniqid()))730 ->and($controller->url_stat[2] = false)731 ->then732 ->array($controller->url_stat(uniqid(), STREAM_URL_STAT_QUIET))->isNotEmpty()733 ->boolean($controller->url_stat(uniqid(), STREAM_URL_STAT_QUIET))->isFalse()734 ->array($controller->url_stat(uniqid(), STREAM_URL_STAT_QUIET))->isNotEmpty()735 ;736 }737 public function testUnlink()738 {739 $this740 ->if($controller = new testedClass(uniqid()))741 ->then742 ->boolean($controller->unlink(uniqid()))->isTrue()743 ->boolean($controller->stream_stat())->isFalse()744 ->boolean($controller->unlink(uniqid()))->isFalse()745 ->boolean($controller->stream_stat())->isFalse()746 ->if($controller->exists())747 ->then748 ->boolean($controller->unlink(uniqid()))->isTrue()749 ->boolean($controller->stream_stat())->isFalse()750 ->boolean($controller->unlink(uniqid()))->isFalse()751 ->boolean($controller->stream_stat())->isFalse()752 ->if($controller->exists())753 ->and($controller->isNotWritable())754 ->then755 ->boolean($controller->unlink(uniqid()))->isFalse()756 ->array($controller->stream_stat())->isNotEmpty()757 ->if($controller->isWritable())758 ->boolean($controller->unlink(uniqid()))->isTrue()759 ->boolean($controller->stream_stat())->isFalse()760 ->boolean($controller->unlink(uniqid()))->isFalse()761 ->boolean($controller->stream_stat())->isFalse()762 ;763 }764 public function testRename()765 {766 $this767 ->if($controller = new testedClass(uniqid()))768 ->then769 ->boolean($controller->rename(uniqid(), $newPath = uniqid()))->isTrue()770 ->string($controller->getPath())->isEqualTo($newPath)771 ->if($controller->rename = false)772 ->then773 ->boolean($controller->rename(uniqid(), uniqid()))->isFalse()774 ->string($controller->getPath())->isEqualTo($newPath)775 ;...

Full Screen

Full Screen

stream_stat

Using AI Code Generation

copy

Full Screen

1$stat = $controller->stream_stat();2var_dump($stat);3array(13) {4 int(0)5 int(0)6 int(0)7 int(0)8 int(0)9 int(0)10 int(0)11 int(0)12 int(0)13 int(0)14 int(0)15 int(-1)16 int(-1)17}18$stat = $controller->stream_stat();19var_dump($stat);20array(13) {21 int(0)22 int(0)23 int(0)24 int(0)25 int(0)26 int(0)27 int(0)28 int(0)29 int(0)30 int(0)31 int(0)32 int(-1)33 int(-1)34}

Full Screen

Full Screen

stream_stat

Using AI Code Generation

copy

Full Screen

1$controller = new Controller();2$controller->stream_stat();3$controller = new Controller();4$controller->stream_stat();5$controller = new Controller();6$controller->stream_stat();7$controller = new Controller();8$controller->stream_stat();9$controller = new Controller();10$controller->stream_stat();11$controller = new Controller();12$controller->stream_stat();13$controller = new Controller();14$controller->stream_stat();15$controller = new Controller();16$controller->stream_stat();17$controller = new Controller();18$controller->stream_stat();19$controller = new Controller();20$controller->stream_stat();21$controller = new Controller();22$controller->stream_stat();23$controller = new Controller();24$controller->stream_stat();25$controller = new Controller();26$controller->stream_stat();27$controller = new Controller();28$controller->stream_stat();29$controller = new Controller();30$controller->stream_stat();31$controller = new Controller();32$controller->stream_stat();33$controller = new Controller();34$controller->stream_stat();

Full Screen

Full Screen

stream_stat

Using AI Code Generation

copy

Full Screen

1$controller = new Controller();2$stats = $controller->stream_stat();3var_dump($stats);4$controller = new Controller();5$stats = $controller->stream_stat();6var_dump($stats);7array(13) {8 int(33206)9 int(33206)10 int(33206)11 int(1)12 int(1000)13 int(1000)14 int(0)15 int(0)16 int(0)

Full Screen

Full Screen

stream_stat

Using AI Code Generation

copy

Full Screen

1$stream = fopen("controller.php", "r");2$stat = fstat($stream);3print_r($stat);4$stat = stat("controller.php");5print_r($stat);6$stat = stat("controller.php");7print_r($stat);8$stat = stat("controller.php");9print_r($stat);

Full Screen

Full Screen

stream_stat

Using AI Code Generation

copy

Full Screen

1$size = $controller->stream_stat('1.php');2print $size;3$size = $controller->stream_stat('test/1.php');4print $size;5$size = $controller->stream_stat('test/2.php');6print $size;7$size = $controller->stream_stat('test/3.php');8print $size;9$size = $controller->stream_stat('test/4.php');10print $size;11$size = $controller->stream_stat('test/5.php');12print $size;13$size = $controller->stream_stat('test/6.php');14print $size;15$size = $controller->stream_stat('test/7.php');16print $size;17$size = $controller->stream_stat('test/8.php');18print $size;19$size = $controller->stream_stat('test/9.php');20print $size;21$size = $controller->stream_stat('test/10.php');22print $size;

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in controller

Trigger stream_stat code on LambdaTest Cloud Grid

Execute automation tests with stream_stat on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful