1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
class ViewTest extends \PHPUnit\Framework\TestCase |
4
|
|
|
{ |
5
|
|
|
public function testGet() |
6
|
|
|
{ |
7
|
|
|
$router = new \Slim\Router(); |
|
|
|
|
8
|
|
|
$container = new \Slim\Container(); |
9
|
|
|
$container['mailer'] = new \Swift_SendmailTransport(); |
10
|
|
|
$container['aimeos'] = new \Aimeos\Bootstrap(); |
11
|
|
|
$container['aimeos.config'] = new \Aimeos\Slim\Base\Config( $container, array() ); |
12
|
|
|
$container['aimeos.context'] = new \Aimeos\Slim\Base\Context( $container ); |
13
|
|
|
$container['aimeos.i18n'] = new \Aimeos\Slim\Base\I18n( $container ); |
14
|
|
|
$container['request'] = \Slim\Http\Request::createFromEnvironment( \Slim\Http\Environment::mock() ); |
15
|
|
|
$container['response'] = new \Slim\Http\Response(); |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
$object = new \Aimeos\Slim\Base\View( $container ); |
19
|
|
|
$attr = array( 'site' => 'unittest', 'locale' => 'en', 'currency' => 'EUR' ); |
20
|
|
|
$view = $object->create( $container['aimeos.context']->get( false ), $container['request'], $container['response'], $attr, array(), 'en' ); |
21
|
|
|
|
22
|
|
|
$this->assertInstanceOf( '\Aimeos\MW\View\Iface', $view ); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
public function testGetNoLocale() |
27
|
|
|
{ |
28
|
|
|
$router = new \Slim\Router(); |
|
|
|
|
29
|
|
|
$container = new \Slim\Container(); |
30
|
|
|
$container['mailer'] = new \Swift_SendmailTransport(); |
31
|
|
|
$container['aimeos'] = new \Aimeos\Bootstrap(); |
32
|
|
|
$container['aimeos.config'] = new \Aimeos\Slim\Base\Config( $container, array() ); |
33
|
|
|
$container['aimeos.context'] = new \Aimeos\Slim\Base\Context( $container ); |
34
|
|
|
$container['aimeos.i18n'] = new \Aimeos\Slim\Base\I18n( $container ); |
35
|
|
|
$container['request'] = \Slim\Http\Request::createFromEnvironment( \Slim\Http\Environment::mock() ); |
36
|
|
|
$container['response'] = new \Slim\Http\Response(); |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
$object = new \Aimeos\Slim\Base\View( $container ); |
40
|
|
|
$attr = array( 'site' => 'unittest', 'locale' => 'en', 'currency' => 'EUR' ); |
41
|
|
|
$view = $object->create( $container['aimeos.context']->get( false ), $container['request'], $container['response'], $attr, array() ); |
42
|
|
|
|
43
|
|
|
$this->assertInstanceOf( '\Aimeos\MW\View\Iface', $view ); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|