Added Classmap::addClassmap() method
This commit is contained in:
parent
15123e9719
commit
fffc5f71da
|
@ -83,4 +83,11 @@ class Classmap
|
|||
{
|
||||
return isset($this->classmap[$type]);
|
||||
}
|
||||
|
||||
public function addClassmap(Classmap $classmap)
|
||||
{
|
||||
foreach ($classmap->all() as $type => $classname) {
|
||||
$this->add($type, $classname);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -64,4 +64,18 @@ class ClassmapTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->assertSame($map, $classmap->all());
|
||||
}
|
||||
|
||||
public function testAddClassmap()
|
||||
{
|
||||
$classmap1 = new Classmap();
|
||||
$classmap2 = new Classmap();
|
||||
|
||||
$classmap2->add('foobar', 'BeSimple\SoapCommon\Classmap');
|
||||
$classmap1->addClassmap($classmap2);
|
||||
|
||||
$this->assertEquals(array('foobar' => 'BeSimple\SoapCommon\Classmap'), $classmap1->all());
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
$classmap1->addClassmap($classmap2);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue