Beispiel #1
0
function file_get_contents($url, $flags = null, $context = null, $offset = null, $maxlen = null)
{
    global $fofTest_FakeFopen_Active;
    if (!$fofTest_FakeFopen_Active) {
        return \file_get_contents($url, $flags, $context, $offset, $maxlen);
    }
    return FakeFopen::file_get_contents($url, $flags, $context, $offset, $maxlen);
}
Beispiel #2
0
 /**
  * @covers  FOF30\Download\Adapter\Fopen::downloadAndReturn
  *
  * @dataProvider    FOF30\Tests\Download\Adapter\FopenDataprovider::getTestDownloadAndReturn
  *
  * @param array $config
  * @param array $test
  */
 public function testDownloadAndReturn(array $config, array $test)
 {
     FakeFopen::setUp($config);
     $adapter = new Fopen();
     if ($test['exception'] !== false) {
         $this->setExpectedException($test['exception']['name'], $test['exception']['message'], $test['exception']['code']);
     }
     $ret = $adapter->downloadAndReturn($test['url'], $test['from'], $test['to']);
     $retSize = 0;
     if (is_string($ret)) {
         $retSize = strlen($ret);
     }
     $this->assertEquals($test['retSize'], $retSize, $test['message']);
 }