public function testCreateFromData()
 {
     $manager = new FileSystemFileManager();
     $file = $manager->createFromData('Some <em>text</em>...', 'text/html');
     $this->assertEquals('Some <em>text</em>...', $file->getData());
     $this->assertEquals('text/html', $file->getMimeType());
     $manager->delete($file);
 }
Esempio n. 2
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);
 }