CRUDlexTests\SimpleFilesystemFileProcessorTest::testCreateFile PHP Method

testCreateFile() public method

public testCreateFile ( )
    public function testCreateFile()
    {
        $this->cleanUpFiles();
        $entityLibrary = $this->dataLibrary->createEmpty();
        $entityLibrary->set('name', 'lib');
        $this->dataLibrary->create($entityLibrary);
        $entityBook = $this->dataBook->createEmpty();
        $entityBook->set('title', 'title');
        $entityBook->set('author', 'author');
        $entityBook->set('pages', 111);
        $entityBook->set('library', $entityLibrary->get('id'));
        $this->dataBook->create($entityBook);
        $file = __DIR__ . '/../test1A.xml';
        copy(__DIR__ . '/../test1.xml', $file);
        $request = new Request([], ['title' => 'title', 'author' => 'author', 'pages' => 111, 'library' => $entityLibrary->get('id')], [], [], ['cover' => new UploadedFile($file, 'test1A.xml', 'application/xml', filesize($file), null, true)]);
        $this->fileProcessor->createFile($request, $entityBook, 'book', 'cover');
        $this->assertTrue(file_exists($this->file1));
        $request = new Request([], ['title' => 'title', 'author' => 'author', 'pages' => 111, 'library' => $entityLibrary->get('id'), 'cover' => null]);
        $this->fileProcessor->createFile($request, $entityBook, 'book', 'cover');
    }