Skip to content

Commit

Permalink
[ticket/14696] Be perfect
Browse files Browse the repository at this point in the history
PHPBB3-14696
  • Loading branch information
lavigor committed Jun 26, 2016
1 parent 471a773 commit 27f16a1
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions tests/email/email_parsing_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@

class phpbb_email_parsing_test extends phpbb_test_case
{
static protected $reflection;
/** @var \messenger */
protected $messenger;

/** @var \ReflectionProperty */
protected $reflection_template_property;

public function setUp()
Expand All @@ -23,20 +25,12 @@ public function setUp()

$phpbb_container = new phpbb_mock_container_builder;

$config = new \phpbb\config\config(array());
$default_config = array(
$config = new \phpbb\config\config(array(
'board_email_sig' => '-- Thanks, The Management',
'sitename' => 'yourdomain.com',
'default_lang' => 'en',
);
foreach ($default_config as $config_name => $config_value)
{
if (!isset($config[$config_name]))
{
$config[$config_name] = $config_value;
}
}
$phpbb_container->set('config', $config, phpbb_mock_container_builder::SCOPE_PROTOTYPE);
));
$phpbb_container->set('config', $config);

$request = new phpbb_mock_request;
$symfony_request = new \phpbb\symfony_request(
Expand All @@ -50,16 +44,16 @@ public function setUp()
$phpbb_root_path,
$phpEx
);
$phpbb_container->set('path_helper', $phpbb_path_helper, phpbb_mock_container_builder::SCOPE_PROTOTYPE);
$phpbb_container->set('filesystem', $filesystem, phpbb_mock_container_builder::SCOPE_PROTOTYPE);
$phpbb_container->set('path_helper', $phpbb_path_helper);
$phpbb_container->set('filesystem', $filesystem);

$cache_path = 'cache/' . PHPBB_ENVIRONMENT . '/twig';
$phpbb_container->setParameter('core.template.cache_path', $cache_path, phpbb_mock_container_builder::SCOPE_PROTOTYPE);
$cache_path = $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/twig';
$phpbb_container->setParameter('core.template.cache_path', $cache_path);

$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime');
$phpbb_container->set('user', $user, phpbb_mock_container_builder::SCOPE_PROTOTYPE);
$phpbb_container->set('user', $user);
$extension_manager = new phpbb_mock_extension_manager(
dirname(__FILE__) . '/',
array(
Expand All @@ -70,11 +64,15 @@ public function setUp()
),
)
);
$phpbb_container->set('ext.manager', $extension_manager, phpbb_mock_container_builder::SCOPE_PROTOTYPE);
$phpbb_container->set('ext.manager', $extension_manager);

$context = new \phpbb\template\context();
$twig_extension = new \phpbb\template\twig\extension($context, $user);
$phpbb_container->set('template.twig.extensions.collection', array($twig_extension), phpbb_mock_container_builder::SCOPE_PROTOTYPE);
$twig_extension = new \phpbb\template\twig\extension($context, $lang);
$phpbb_container->set('template.twig.extensions.phpbb', $twig_extension);

$twig_extensions_collection = new \phpbb\di\service_collection($phpbb_container);
$twig_extensions_collection->add('template.twig.extensions.phpbb');
$phpbb_container->set('template.twig.extensions.collection', $twig_extensions_collection);

$twig = new \phpbb\template\twig\environment(
$config,
Expand All @@ -91,7 +89,7 @@ public function setUp()
)
);
$twig->addExtension($twig_extension);
$phpbb_container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig), phpbb_mock_container_builder::SCOPE_PROTOTYPE);
$phpbb_container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig));

if (!class_exists('messenger'))
{
Expand Down

0 comments on commit 27f16a1

Please sign in to comment.