Пример #1
0
 public function setUp()
 {
     $options = array();
     $this->optionsResolver = $this->getOptionsResolverMock('foo', $options);
     $this->typeMock = $this->getMock('EMC\\TableBundle\\Table\\Column\\Type\\ColumnTypeInterface');
     $this->typeMock->expects($this->any())->method('getOptionsResolver')->will($this->returnValue($this->optionsResolver));
     $this->registryMock = $this->getMock('EMC\\TableBundle\\Table\\Column\\ColumnRegistryInterface');
     $this->registryMock->expects($this->any())->method('getType')->with('bar')->will($this->returnValue($this->typeMock));
     $this->factory = new ColumnFactory($this->registryMock);
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 private function resolve($type)
 {
     if ($type instanceof ColumnTypeInterface) {
         return $type;
     } else {
         if (is_string($type)) {
             return $this->registry->getType($type);
         }
     }
     throw new \InvalidArgumentException('$type ColumnTypeInterface|string expected, "' . gettype($type) . '" found');
 }
Пример #3
0
 public function testHasType()
 {
     $this->assertEquals(true, $this->registry->hasType('x'));
     $this->assertEquals(false, $this->registry->hasType('p'));
 }