Esempio n. 1
0
 public function __construct($method, $url, Configuration $hostConfig, Project $project = NULL)
 {
     $this->url = $url;
     $this->method = $method;
     $this->project = $project ?: \Psc\PSC::getProject();
     $this->hostConfig = $hostConfig;
 }
Esempio n. 2
0
 /**
  * Fügt ein TabsContentItem (nur V2) den Tabs hinzu
  *
  * der Content wird per Ajax geladen mit der URL die das TabsContentItem angibt
  */
 public function addItem(TabsContentItem $item)
 {
     if ($item instanceof \Psc\Doctrine\Entity && \Psc\PSC::getProject()->isDevelopment()) {
         throw new \Psc\DeprecatedException('Entities übergeben ist deprecated. Psc\\CMS\\Item\\Adapter benutzen.');
     }
     return $this->add($item->getTabsLabel(TabsContentItem::LABEL_TAB), NULL, $item->getTabsURL(), HTML::string2id(implode('-', $item->getTabsId())));
 }
Esempio n. 3
0
 /**
  * @deprecated
  * @cc-ignore
  */
 public function getClass()
 {
     if (PSC::getProject()->isDevelopment()) {
         throw new \Psc\DeprecatedException('getClass ist deprecated. Bitte \\Psc\\Code\\Code::getClass($this) benutzen');
     }
     return get_class($this);
 }
Esempio n. 4
0
 public function __construct($fileName, array $vars = array(), $tabLabel = NULL, Dir $root = NULL)
 {
     $this->directory = $root ?: PSC::getProject()->dir('cms-tpl');
     $this->setFileName($fileName);
     $this->vars = $vars;
     $this->tabLabel = $tabLabel ?: $this->file->getName(File::WITHOUT_EXTENSION);
 }
Esempio n. 5
0
 public function testBuilderCreatesPhar()
 {
     return;
     $coreBuilder = new CoreBuilder(nativePSC::getProject()->getClassPath()->up());
     $coreBuilder->compile($this->out);
     $this->out->exists();
 }
Esempio n. 6
0
 public function __construct(GClass $class, Dir $testsDir = NULL)
 {
     $this->setLogger(new \Psc\System\BufferLogger());
     $this->class = $class;
     $this->dir = $testsDir ?: PSC::getProject()->dir('tests');
     $this->testClass = new GClass('\\Psc\\Code\\Test\\Base');
 }
Esempio n. 7
0
 /**
  * @param string $name der Name des JSManagers
  */
 public function __construct($name, Project $project = NULL)
 {
     parent::__construct($name);
     $this->project = $project ?: PSC::getProject();
     if ($this->name == 'default') {
         $this->url = $this->project->getConfiguration()->get(array('js', 'url'), '/js/');
     }
 }
Esempio n. 8
0
 public function testConstruct_DPI_Constructor()
 {
     $module = new Module(\Psc\PSC::getProject());
     $em = $this->doublesManager->createEntityManagerMock();
     $package = new DCPackage($module, $em);
     $this->assertSame($em, $package->getEntityManager());
     $this->assertSame($module, $package->getModule());
 }
 public function __construct(DCPackage $dc, array $languages, $language, ContentStreamConverter $contentStreamConverter = NULL)
 {
     $this->dc = $dc;
     $this->setLanguages($languages);
     $this->setLanguage($language);
     $this->contentStreamConverter = $contentStreamConverter;
     $this->project = PSC::getProject();
 }
Esempio n. 10
0
 /**
  * @return Webforge\Common\System\File
  */
 protected function getGClassFromFile()
 {
     $project = \Psc\PSC::getProject();
     $gClass = new GClass(Code::mapFileToClass($this->file, $project->dir('lib')));
     $gClass->setSrcFileName((string) $this->file);
     // damit wir wirklich fremde sourcen angeben können
     return $gClass;
 }
 public function setUp()
 {
     $this->chainClass = 'Psc\\CMS\\Service\\StandardControllerService';
     parent::setUp();
     $this->svc = new StandardControllerService(\Psc\PSC::getProject());
     $this->ctrlClass = __NAMESPACE__ . '\\MyTestController';
     $this->svc->setControllerClass('test', $this->ctrlClass);
 }
Esempio n. 12
0
 public function setUp()
 {
     $this->chainClass = 'Psc\\CMS\\Service\\EntityService';
     parent::setUp();
     $this->project = clone \Psc\PSC::getProject();
     $this->dc = new \Psc\Doctrine\DCPackage($this->getModule('Doctrine'));
     $this->factory = new Factory('Psc\\Test\\Controllers', $this->getContainer());
     $this->svc = new EntityService($this->dc, $this->factory, $this->project, 'entities');
 }
Esempio n. 13
0
 public function __construct($name = 'requirejs', $main = '/js/boot.js', $requirejsSource = '/psc-cms-js/vendor/require.js')
 {
     if (\Psc\PSC::getProject()->isDevelopment()) {
         throw new DeprecatedException('Dont use this, use HTML\\Frameworkpage');
     }
     parent::__construct($name);
     $this->requirejsSource = $requirejsSource;
     $this->main = $main;
 }
Esempio n. 14
0
 public function setUp()
 {
     $this->assertNotEmpty($this->entityName, 'EntityName muss für den RepositoryTestCase gesetzt sein (nur der ClassName)');
     // henne + ei problem hier:
     $entityFQN = $this->entityName;
     $this->chainClass = \Psc\PSC::getProject()->getModule('Doctrine')->getEntitiesNamespace($entityFQN . 'Repository');
     parent::setUp();
     $this->repository = $this->em->getRepository($entityFQN);
 }
Esempio n. 15
0
 public function setUp()
 {
     $config = PSC::getProject()->getConfiguration();
     if ($config->get('executables.rar') === NULL) {
         // sonst macht der test hier keinen sinn
         $this->markTestSkipped('Kann Test nicht ausführen, da kein rar-Executable in der Config angegeben ist.');
     }
     $this->finder = new ExecutableFinder($config->get('executables'));
 }
Esempio n. 16
0
 /**
  * 
  * Config::require('key1','key2','key3');
  * oder
  * Config::require('key1.key2.key3');
  * @param string $key Array indizes können mit . getrennt werden
  * @exception wenn es den Config eintrag nicht gibt
  * @return mixed
  */
 public static function req($key)
 {
     $args = func_get_args();
     if (count($args) > 1) {
         return PSC::getProject()->getConfiguration()->req($args);
     } else {
         return PSC::getProject()->getConfiguration()->req($key);
     }
     return $array;
 }
Esempio n. 17
0
 public function __construct(Application $application = NULL, \Psc\Doctrine\Module $doctrine = NULL, Project $project = NULL)
 {
     $this->name = 'Psc Command Line Interface';
     $this->version = NULL;
     $this->cli = $application ?: new Application($this->name, $this->version);
     $this->cli->setCatchExceptions(true);
     $this->cli->setHelperSet(new HelperSet(array('dialog' => new \Symfony\Component\Console\Helper\DialogHelper($warnDeprecation = false))));
     $this->project = $project ?: \Psc\PSC::getProject();
     $this->doctrine = $doctrine ?: $GLOBALS['env']['container']->getModule('Doctrine');
     $this->setUp();
 }
Esempio n. 18
0
 /**
  * @return Psc\Net\HTTP\Request
  */
 public function createHTTPRequest($methodString, $resource, $GET = array(), $POST = array(), $COOKIE = array(), $accept = NULL)
 {
     \Psc\Code\Code::value($methodString, 'GET', 'POST');
     $project = \Psc\PSC::getProject();
     $baseUrl = $project->getHostUrl('base');
     $SERVER = array('HTTP_HOST' => $baseUrl->getHost(), 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.0; rv:7.0.1) Gecko/20100101 Firefox/7.0.1', 'HTTP_ACCEPT' => $accept ?: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5', 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_CONNECTION' => 'keep-alive', 'SERVER_NAME' => $baseUrl->getHost(), 'DOCUMENT_ROOT' => (string) $project->dir('www'), 'REDIRECT_QUERY_STRING' => 'request=' . $resource, 'REDIRECT_URL' => $resource, 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => $methodString, 'QUERY_STRING' => 'request=' . $resource, 'REQUEST_URI' => $resource, 'SCRIPT_NAME' => '/api.php', 'PHP_SELF' => '/api.php', 'REQUEST_TIME' => time());
     //$request = create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null)
     $request = SfRequest::create((string) $baseUrl . '/' . ltrim($resource, '/'), $methodString, $methodString === 'POST' ? $POST : $GET, $COOKIE, array(), $SERVER);
     $request = Request::infer($request);
     return $request;
 }
Esempio n. 19
0
 /**
  * @group gn
  */
 public function testGetClassName_underscoreStyle()
 {
     if (\Psc\PSC::getProject() !== 'psc-laptop' && \Psc\PSC::getProject() !== 'psc-desktop') {
         $this->markTestSkipped('kein bekanntes BaseDir definiert');
     }
     $file = new File('D:\\www\\psc-cms\\Umsetzung\\base\\src\\Psc\\Code\\Generate\\GClass.php');
     $dir = new Dir('D:\\www\\psc-cms\\Umsetzung\\base\\src\\');
     $this->assertEquals('Psc_Code_Generate_GClass', Code::mapFileToClass($file, $dir, '_'));
     $file = new File('D:\\www\\psc-cms\\Umsetzung\\base\\src\\PHPWord\\PHPWord.php');
     $dir = new Dir('D:\\www\\psc-cms\\Umsetzung\\base\\src\\PHPWord\\');
     $this->assertEquals('PHPWord', Code::mapFileToClass($file, $dir, '_'));
 }
Esempio n. 20
0
 public static function handler(\Exception $e)
 {
     try {
         $project = PSC::getProject();
     } catch (\Exception $noProjet) {
         $project = NULL;
     }
     $format = PHP_SAPI === 'cli' ? 'text' : 'html';
     $text = self::getExceptionText($e, $format, $project);
     print $text;
     PSC::getEnvironment()->getErrorHandler()->handleCaughtException($e);
 }
Esempio n. 21
0
 public function setUp()
 {
     $this->chainClass = 'Psc\\CMS\\Projectmain';
     parent::setUp();
     $this->user = $this->createUser();
     $this->authController = $this->createAuthController($this->user);
     $this->environment = new Environment();
     $this->project = PSC::getProject();
     // inject a lot
     $this->cms = new ProjectMain($this->project, NULL, NULL, NULL, 10, NULL, $this->environment);
     $this->cms->setContainerClass('Psc\\Test\\CMS\\Container');
     $this->cms->setAuthController($this->authController);
     $this->cms->init();
 }
Esempio n. 22
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $project = \Psc\PSC::getProject();
     $em = $project->getModule('Doctrine')->getEntityManager($input->getOption('con'));
     try {
         $r = new \Psc\Form\EmailValidatorRule();
         $email = $r->validate($input->getArgument('email'));
     } catch (\Exception $e) {
         $output->writeln('FEHLER: E-Mail-Adresse ist nicht korrekt.');
         return 1;
     }
     if (($password = $input->getOption('password')) == NULL) {
         $password = \Webforge\Common\String::random(6);
     }
     $c = $project->getUserClass();
     if ($input->getOption('reset-password') == TRUE) {
         $userRep = $em->getRepository($c);
         $user = $userRep->find($email);
         if (!$user instanceof \Psc\CMS\User) {
             $output->writeln('User mit der Email: "' . $email . '" nicht gefunden.');
             return 2;
         }
         $output->writeln('Passwort Reset für: ' . $email);
     } else {
         $user = new $c($email);
     }
     $user->hashPassword($password);
     try {
         $em->persist($user);
         $em->flush();
     } catch (\PDOException $e) {
         if (\Psc\Doctrine\Exception::convertPDOException($e) instanceof \Psc\Doctrine\UniqueConstraintException) {
             $output->writeln('User existiert bereits. --reset-password / -r nehmen, um ein neues Passwort zu erzeugen');
             return 3;
         }
         throw $e;
     }
     $output->writeln(sprintf('Passwort: "%s"', $password));
     $output->writeln('done.');
     return 0;
 }
Esempio n. 23
0
 public function getUserManager()
 {
     if (!isset($this->userManager)) {
         $this->userManager = new UserManager(PSC::getProject()->getModule('Doctrine')->getRepository($this->userClass));
     }
     return $this->userManager;
 }
Esempio n. 24
0
<?php

$ds = DIRECTORY_SEPARATOR;
require_once __DIR__ . $ds . '..' . $ds . '..' . $ds . 'auto.prepend.php';
ini_set('memory_limit', '-1');
\Psc\PSC::getProject()->setTests(TRUE);
Esempio n. 25
0
 public function __construct(Project $project = NULL)
 {
     $this->project = $project ?: \Psc\PSC::getProject();
 }
Esempio n. 26
0
 /**
  * @return Psc\Code\Test\ResourceHelper
  */
 public function getResourceHelper()
 {
     if (!isset($this->resourceHelper)) {
         $this->resourceHelper = new ResourceHelper(PSC::getProject());
     }
     return $this->resourceHelper;
 }
Esempio n. 27
0
 public function setUp()
 {
     $this->project = PSC::getProject();
 }
Esempio n. 28
0
 public function testSetGetProject()
 {
     $this->test->object = $this->service;
     $this->test->setter('project', NULL, \Psc\PSC::getProject());
 }
Esempio n. 29
0
 /**
  * @return EntityManager
  */
 public function getEM()
 {
     return \Psc\PSC::getProject()->getModule('Doctrine')->getEntityManager();
 }
Esempio n. 30
0
 public function createService($project = NULL)
 {
     return new Service($project ?: PSC::getProject());
 }