/**
  * @covers Veles\View\Adapters\ViewAdapterAbstract::instance
  * @covers Veles\View\Adapters\ViewAdapterAbstract::invokeLazyCalls
  */
 public function testInstance()
 {
     $this->object->addCalls([]);
     $this->object->setInstance(null);
     $expected = '\\Veles\\Tests\\View\\Adapters\\ViewAdapterAbstractChild';
     $result = $this->object->instance();
     $msg = 'ViewAdapterAbstract::instance() returns wrong result!';
     $this->assertInstanceOf($expected, $result, $msg);
     $this->assertAttributeInstanceOf($expected, 'instance', $this->object, $msg);
     $this->object->setInstance(null);
     $this->object->addCalls([['method' => 'testCall', 'arguments' => ['string']]]);
     $result = $this->object->instance();
     $msg = 'ViewAdapterAbstract::instance() returns wrong result!';
     $this->assertInstanceOf($expected, $result, $msg);
     $result = $this->object->getCalls();
     $this->assertSame([], $result);
     View::setAdapter(NativeAdapter::instance());
 }
Пример #2
0
 /**
  * @covers Veles\Routing\Route::getAdapter
  */
 public function testGetAdapter()
 {
     $this->object->method('getUri')->willReturn('/');
     $expected = NativeAdapter::instance();
     $result = $this->object->init()->getAdapter();
     $msg = 'Route::getAdapter() returns wrong result!';
     $this->assertEquals($expected, $result, $msg);
 }
Пример #3
0
 /**
  * Unit-test for View::getAdapter
  * @covers Veles\View\View::getAdapter
  * @see Veles\View\View::getAdapter
  */
 public function testGetAdapter()
 {
     $expected = NativeAdapter::instance();
     $_SERVER['REQUEST_URI'] = 'index.html';
     $result = View::getAdapter();
     $msg = 'Wrong View::getAdapter() result';
     $this->assertSame($expected, $result, $msg);
     $expected = NativeAdapter::instance();
     View::unsetAdapter();
     View::setAdapter($expected);
     $result = View::getAdapter();
     $this->assertSame($expected, $result, $msg);
 }