ControllerProviderTest::testRenderFile PHP Метод

testRenderFile() публичный Метод

public testRenderFile ( )
    public function testRenderFile()
    {
        $client = $this->createClient();
        $crawler = $client->request('GET', '/crud/foo/1/cover/file');
        $this->assertTrue($client->getResponse()->isNotFound());
        $this->assertCount(1, $crawler->filter('html:contains("Entity not found")'));
        $crawler = $client->request('GET', '/crud/book/666/cover/file');
        $this->assertTrue($client->getResponse()->isNotFound());
        $this->assertCount(1, $crawler->filter('html:contains("Instance not found")'));
        $library = $this->dataLibrary->createEmpty();
        $library->set('name', 'lib a');
        $this->dataLibrary->create($library);
        $file = __DIR__ . '/../test1.xml';
        $client->request('POST', '/crud/book/create', ['title' => 'title', 'author' => 'author', 'pages' => 111, 'price' => 3.99, 'library' => $library->get('id')], ['cover' => new UploadedFile($file, 'test1.xml', 'application/xml', filesize($file), null, true)]);
        $crawler = $client->request('GET', '/crud/book/1/title/file');
        $this->assertTrue($client->getResponse()->isNotFound());
        $this->assertCount(1, $crawler->filter('html:contains("Instance not found")'));
        $crawler = $client->request('GET', '/crud/book/1/cover/file');
        $this->assertTrue($client->getResponse()->isOk());
        $this->assertCount(1, $crawler->filter('html:contains("rendered file")'));
        $this->fileProcessorHandle->createFile->once()->called();
        $this->fileProcessorHandle->updateFile->never()->called();
        $this->fileProcessorHandle->deleteFile->never()->called();
        $this->fileProcessorHandle->renderFile->once()->called();
    }