protected function setUp()
 {
     $this->fileProcessor = new CRUDSimpleFilesystemFileProcessor();
     $crudServiceProvider = CRUDTestDBSetup::createCRUDServiceProvider();
     $this->dataBook = $crudServiceProvider->getData('book');
     $this->dataLibrary = $crudServiceProvider->getData('library');
     $this->file1 = __DIR__ . '/../uploads/book/1/cover/test1A.xml';
     $this->file2 = __DIR__ . '/../uploads/book/1/cover/test2A.xml';
     $this->cleanUpFiles();
 }
 public function createApplication()
 {
     $app = CRUDTestDBSetup::createAppAndDB();
     $app->register(new Silex\Provider\SessionServiceProvider());
     $app['session.test'] = true;
     $app['debug'] = true;
     $app['exception_handler']->disable();
     $this->fileProcessor = new CRUDNullFileProcessor();
     $dataFactory = new CRUDlex\CRUDMySQLDataFactory($app['db']);
     $app->register(new CRUDlex\CRUDServiceProvider(), array('crud.file' => __DIR__ . '/../crud.yml', 'crud.datafactory' => $dataFactory, 'crud.fileprocessor' => $this->fileProcessor));
     $app->register(new Silex\Provider\UrlGeneratorServiceProvider());
     $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
     $app->mount('/crud', new CRUDlex\CRUDControllerProvider());
     $this->dataBook = $app['crud']->getData('book');
     $this->dataLibrary = $app['crud']->getData('library');
     return $app;
 }
Esempio n. 3
0
 public function testRenderFile()
 {
     $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);
     $fileProcessor = CRUDTestDBSetup::getFileProcessor();
     $fileProcessor->reset();
     $this->dataBook->renderFile($entityBook, 'book', 'cover');
     $this->assertFalse($fileProcessor->isCreateFileCalled());
     $this->assertFalse($fileProcessor->isUpdateFileCalled());
     $this->assertFalse($fileProcessor->isDeleteFileCalled());
     $this->assertTrue($fileProcessor->isRenderFileCalled());
     $fileProcessor->reset();
 }
 protected function setUp()
 {
     $crudServiceProvider = CRUDTestDBSetup::createCRUDServiceProvider();
     $this->definition = $crudServiceProvider->getData('book')->getDefinition();
     $this->definitionLibrary = $crudServiceProvider->getData('library')->getDefinition();
 }
Esempio n. 5
0
 protected function setUp()
 {
     $this->crudServiceProvider = CRUDTestDBSetup::createCRUDServiceProvider();
     $this->dataBook = $this->crudServiceProvider->getData('book');
     $this->dataLibrary = $this->crudServiceProvider->getData('library');
 }