Esempio n. 1
0
 /**
  * Initializes context.
  * Every scenario gets its own context object.
  */
 public function __construct()
 {
     $this->doctrineHelper = new DoctrineHelper();
     self::$entityManager = $this->doctrineHelper->entityManager;
     $classes = $this->doctrineHelper->entityManager->getMetadataFactory()->getAllMetadata();
     $schemaTool = new SchemaTool($this->doctrineHelper->entityManager);
     $schemaTool->dropSchema($classes);
     $schemaTool->createSchema($classes);
     $appBuilderFactory = new Conpago\AppBuilderFactory();
     $appBuilder = $appBuilderFactory->createAppBuilder("Web", ".");
     $appBuilder->registerAdditionalModule(new TestModule());
     $appBuilder->buildApp();
     $this->container = $appBuilder->getContainer();
     $this->passwordHasher = $this->container->resolve('Conpago\\Helpers\\Contract\\IPasswordHasher');
     $this->presenter = $this->container->resolve('Conpago\\Presentation\\Contract\\IJsonPresenter');
 }
Esempio n. 2
0
<?php

use Conpago\AppBuilder;
require '../vendor/autoload.php';
$c = (include '../config/devel.php');
$is_debug = $c['devel']['debug'];
if ($is_debug == true) {
    error_reporting(E_ALL);
}
$appBuilderFactory = new \Conpago\AppBuilderFactory();
/** @var AppBuilder $appBuilder */
$appBuilder = $appBuilderFactory->createAppBuilder("Web", "..");
if ($c['devel']['debug'] == true) {
    $appBuilder->buildApp();
} else {
    $appBuilder->readPersistedApp();
}
/**
 * @param AppBuilder $appBuilder
 * @param Exception $e
 * @param $is_debug
 *
 * @throws Exception
 */
function LogException(AppBuilder $appBuilder, \Exception $e, $is_debug)
{
    try {
        $appBuilder->getLogger()->addCritical('Exception caught', ['exception' => $e]);
    } finally {
        if ($is_debug == true) {
            throw $e;