public function setUp() { $maxlevel = 8; $factoryTypeMock = m::mock('Ladybug\\Type\\FactoryType'); $factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3), m::any())->andReturnUsing(function ($var, $level) { $intType = new Type\Int(); $intType->load($var, $level); return $intType; }); $this->type = new Type\Vector\Container($maxlevel, $factoryTypeMock); }
public function setUp() { $maxlevel = 8; $factoryTypeMock = m::mock('Ladybug\\Type\\FactoryType'); $factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3, 4), m::any())->andReturnUsing(function ($var, $level) { $intType = new Type\Int(); $intType->load($var, $level); return $intType; }); $managerInspectorMock = m::mock('Ladybug\\Inspector\\InspectorManager'); $managerInspectorMock->shouldReceive('get')->andReturn(null); $metadataResolverMock = m::mock('Ladybug\\Metadata\\MetadataResolver'); $metadataResolverMock->shouldReceive('has')->andReturn(false); $this->type = new Type\Object\Container($maxlevel, $factoryTypeMock, $managerInspectorMock, $metadataResolverMock); }
public function testLoaderForOtherType() { $this->setExpectedException('Ladybug\\Type\\Exception\\InvalidVariableTypeException'); $var = 'test'; $this->type->load($var); }