Ejemplo n.º 1
0
 /**
  * @depends testEqualsPageSize
  */
 public function testGatherPageSize()
 {
     $fp = new FilePager(self::$gtPageSize, self::$pageSize);
     $page = $fp->getPage(1);
     $fetched = count(explode("\n", $page));
     $this->assertAttributeEquals($fetched, 'pageSize', $fp, 'Fetched');
     $this->assertAttributeEquals(self::$pageSize, 'pageSize', $fp);
 }
Ejemplo n.º 2
0
 /**
  * @test
  */
 public function createCashDirAndFileWithRange()
 {
     $fp = new FilePager($this->goodFile);
     $fp->setCache($this->goodCache);
     $fp->getRange(1, 20);
     $cacheDir = $fp->getCache()->getDir();
     $file = $cacheDir . '/' . $fp->getCache()->getCachedFileName();
     $this->assertTrue(is_dir($cacheDir), "Cannot locate cache directory: {$cacheDir}");
     $this->assertTrue(is_file($file), "Cannot create cache file: {$file}");
     $this->assertTrue(is_readable($file), "Don't have permission to read file: {$file}");
     $this->assertTrue(is_writable($file), "Don't have permission to write in file: {$file}");
 }
Ejemplo n.º 3
0
 /**
  * @test
  * @depends identicalContent
  */
 public function prependAppendLineTest()
 {
     $prepend = "!!! PREPEND !!!";
     $append = "!!! APPEND !!!";
     $this->fp->prependLine($prepend);
     $this->fp->appendLine($append);
     $page = $this->fp->getPage($this->page);
     $exploded = explode("\n", $page);
     foreach ($exploded as $value) {
         $this->assertStringStartsWith($prepend, $value);
         $this->assertStringEndsWith($append, rtrim($value));
     }
 }