コード例 #1
0
ファイル: ColumnFactoryTest.php プロジェクト: cwd/TableBundle
 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
ファイル: ColumnFactory.php プロジェクト: cwd/TableBundle
 /**
  * {@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'));
 }