1 | <?php |
||
9 | class TestHelperJobs |
||
10 | { |
||
11 | private static $aimeos; |
||
12 | private static $context; |
||
13 | |||
14 | |||
15 | public static function bootstrap() |
||
16 | { |
||
17 | self::getAimeos(); |
||
18 | \Aimeos\MShop::cache( false ); |
||
19 | } |
||
20 | |||
21 | |||
22 | public static function getContext( $site = 'unittest' ) |
||
29 | } |
||
30 | |||
31 | |||
32 | public static function getAimeos() |
||
44 | } |
||
45 | |||
46 | |||
47 | public static function getControllerPaths() |
||
50 | } |
||
51 | |||
52 | |||
53 | /** |
||
54 | * @param string $site |
||
55 | */ |
||
56 | private static function createContext( $site ) |
||
57 | { |
||
58 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
||
59 | $aimeos = self::getAimeos(); |
||
60 | |||
61 | |||
62 | $paths = $aimeos->getConfigPaths(); |
||
63 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
||
64 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
||
65 | |||
66 | $conf = new \Aimeos\MW\Config\PHPArray( [], $paths ); |
||
67 | $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
||
68 | $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
||
69 | $ctx->setConfig( $conf ); |
||
70 | |||
71 | |||
72 | $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
||
73 | $ctx->setLogger( $logger ); |
||
74 | |||
75 | |||
76 | $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
||
77 | $ctx->setDatabaseManager( $dbm ); |
||
78 | |||
79 | |||
80 | $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf ); |
||
81 | $ctx->setFilesystemManager( $fs ); |
||
82 | |||
83 | |||
84 | $mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf ); |
||
85 | $ctx->setMessageQueueManager( $mq ); |
||
86 | |||
87 | |||
88 | $cache = new \Aimeos\MW\Cache\None(); |
||
89 | $ctx->setCache( $cache ); |
||
90 | |||
91 | |||
92 | $session = new \Aimeos\MW\Session\None(); |
||
93 | $ctx->setSession( $session ); |
||
94 | |||
95 | |||
96 | $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
||
97 | $ctx->setI18n( array( 'de' => $i18n ) ); |
||
98 | |||
99 | |||
100 | $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $ctx ); |
||
101 | $locale = $localeManager->bootstrap( $site, 'de', '', false ); |
||
102 | $ctx->setLocale( $locale ); |
||
103 | |||
104 | |||
105 | $view = self::createView( $conf ); |
||
106 | $ctx->setView( $view ); |
||
107 | |||
108 | |||
109 | $ctx->setEditor( 'core:controller/jobs' ); |
||
110 | |||
111 | return $ctx; |
||
112 | } |
||
113 | |||
114 | |||
115 | protected static function createView( \Aimeos\MW\Config\Iface $config ) |
||
142 | } |
||
143 | } |
||
144 |