Esempio n. 1
0
 /**
  * @dataProvider unmarshallFileProvider
  * 
  * @param File $expectedFile
  * @param string $json
  */
 public function testUnmarshallFile(FileSystemFile $expectedFile, $json)
 {
     $unmarshaller = self::createUnmarshaller();
     $value = $unmarshaller->unmarshall($json);
     $this->assertTrue($expectedFile->equals($value));
     // cleanup.
     $fileManager = new FileSystemFileManager();
     $fileManager->delete($value);
 }
 /**
  * @depends testDelete
  * @depends testCreateFromFile
  */
 public function testRetrieve()
 {
     $manager = new FileSystemFileManager();
     $mFile = $manager->createFromFile(self::samplesDir() . 'datatypes/file/raw/text.txt', 'text/plain', 'newname.txt');
     $mFile = $manager->retrieve($mFile->getIdentifier());
     $this->assertEquals('text/plain', $mFile->getMimeType());
     $this->assertEquals('newname.txt', $mFile->getFilename());
     $this->assertEquals('I contain some text...', $mFile->getData());
     $manager->delete($mFile);
 }
Esempio n. 3
0
 public function testFile()
 {
     $fManager = new FileSystemFileManager();
     $expression = $this->createFakeExpression();
     $operands = new OperandsCollection();
     $file1 = $fManager->createFromData('Some text', 'text/plain');
     $file2 = $fManager->createFromData('Some text', 'text/plain');
     $operands[] = $file1;
     $operands[] = $file2;
     $processor = new MatchProcessor($expression, $operands);
     $this->assertTrue($processor->process()->getValue());
     $fManager->delete($file1);
     $fManager->delete($file2);
     $operands->reset();
     $file1 = $fManager->createFromData('Some text', 'text/plain');
     $file2 = $fManager->createFromData('Other text', 'text/plain');
     $operands[] = $file1;
     $operands[] = $file2;
     $this->assertFalse($processor->process()->getValue());
     $fManager->delete($file1);
     $fManager->delete($file2);
 }