Esempio n. 1
0
 public function setUp()
 {
     $this->debugOutDir = PSC::get(PSC::PATH_TESTDATA)->sub('webCompOut');
     if (!$this->debugOutDir->exists()) {
         $this->debugOutDir->make('-p');
     }
 }
Esempio n. 2
0
    /**
     * @param string|File $dataFileName wenn ein String wird die Datei in base\files\testdata\logdata\$dataFileName.log.php gespeichert
     */
    public function __construct($dataFileName)
    {
        if ($dataFileName instanceof \Webforge\Common\System\File) {
            $this->file = $datafileName;
        } else {
            $dir = PSC::get(PSC::PATH_TESTDATA)->append('logdata/');
            $this->file = new File($dir, $dataFileName . '.log.php');
        }
        $this->miniTemplate = '<?php
/* Dies ist ein autogeneriertes TestLog von <' . $this->getClass() . '> */
%index%

%data%

?>';
    }
 public function testGrab()
 {
     $sc = new Subcentral();
     // @TODO solve dependency injection für request (mit requestbundle so wie beim serienjunkies grabber)
     $html = $sc->login('technoplayer', 'logf22x3');
     $tvShow = new TvShow();
     $tvShow->setTitle('How I Met Your Mother');
     $boardId = $sc->findBoard($tvShow);
     $season = new Season();
     $season->setNum(7);
     $season->setTvShow($tvShow);
     list($threadLink, $threadId) = $sc->findThread($boardId, $season);
     $subs = $sc->getSubs($threadLink);
     $dir = PSC::get(PSC::PATH_FILES)->append('subs/' . $tvShow->getTitle() . '/' . $season->getNum() . '/');
     $dir->make(Dir::PARENT | Dir::ASSERT_EXISTS);
     $sc->downloadSubs($subs, $dir);
 }
Esempio n. 4
0
 public function getDataSet()
 {
     $dbFixtures = PSC::get(PSC::PATH_TESTDATA) . 'dbfixtures' . DIRECTORY_SEPARATOR;
     $dbFixture = $dbFixtures . $this->xmlName() . '.xml';
     $this->assertFileExists($dbFixture);
     $dataSet = $this->createMySQLXMLDataSet($dbFixture);
     return $dataSet;
 }
Esempio n. 5
0
 /**
  *
  * jeder Schlüssel wird relativ zu einem Verzeichnis in $rootDir abgebildet
  * also
  * thumbnails:50:60:cropped:so98vm.jpg  würde dann im default-Fall (rootDir === NULL)
  * base/cache/thumbnails/50/60/cropped/
  * werden
  */
 public function __construct(Dir $rootDir = NULL, $direct = FALSE)
 {
     $this->directory = $rootDir ?: PSC::get(PSC::PATH_CACHE);
     $this->direct = (bool) $direct;
 }
Esempio n. 6
0
 public function onSourceFileChange(Event $event)
 {
     $file = $event->getData()->file;
     $storage = new Storage(new PHPStorageDriver(new File($this->getCache(), 'storage.changedFiles.php')));
     $data = $storage->init()->getData();
     $data->set(array('files', (string) $file), TRUE);
     $data->set(array('mtime'), time());
     $storage->persist();
     // wir haben die geänderte Datei noch gespeichert, jetzt compilen wir (denn das war gewünscht)
     if ($event->getData()->compile) {
         $out = new File(PSC::get(PSC::ROOT), 'psc-cms.phar.gz');
         $libraryBuilder = new \Psc\Code\Build\LibraryBuilder($this, $logger = new \Psc\System\BufferLogger());
         if ($libraryBuilder->isCompilingNeeded()) {
             $libraryBuilder->compile($out);
             $libraryBuilder->resetCompilingNeeded();
         }
     }
 }
Esempio n. 7
0
 protected function prepareTemp()
 {
     $this->tempSrc = PSC::get(PSC::PATH_FILES)->sub('tmp/' . uniqid('build-phar'));
     /* temp verzeichnis leer anlegen */
     if (!$this->tempSrc->exists()) {
         $this->tempSrc->make(Dir::PARENT);
     } else {
         $this->tempSrc->wipe();
     }
     /* out datei löschen (macht nichts, wenn nicht existiert) */
     $this->out->delete();
 }
Esempio n. 8
0
 public static function install($tpl)
 {
     if (is_array($tpl)) {
         $filename = array_pop($tpl) . '.html';
         $dir = implode('/', $tpl);
     } else {
         $filename = $tpl . '.html';
         $dir = NULL;
     }
     /* check if file exists, and copy */
     $file = new \Webforge\Common\System\File(PSC::get(PSC::PATH_TPL)->append($dir), $filename);
     if (!$file->exists()) {
         $srcFile = clone $file;
         $srcFile->setDirectory(PSC::get(PSC::PATH_PSC_CMS_SRC)->append('psc/files/tpl/')->append($dir));
         if (!$file->getDirectory()->exists()) {
             $file->getDirectory()->make('-p');
         }
         $srcFile->copy($file);
     }
 }