10 $factory->register(
'fallback',
'Fallback',
function () {
13 $this->assertTrue(
true );
14 $this->setExpectedException( InvalidArgumentException::class );
15 $factory->register(
'invalid',
'Invalid',
'Invalid callback' );
23 $this->setExpectedException( SkinException::class );
24 $factory->makeSkin(
'nobuilderregistered' );
32 $factory->register(
'unittest',
'Unittest',
function () {
35 $this->setExpectedException( UnexpectedValueException::class );
36 $factory->makeSkin(
'unittest' );
44 $factory->register(
'testfallback',
'TestFallback',
function () {
48 $skin = $factory->makeSkin(
'testfallback' );
49 $this->assertInstanceOf( Skin::class, $skin );
50 $this->assertInstanceOf( SkinFallback::class, $skin );
51 $this->assertEquals(
'fallback', $skin->getSkinName() );
60 $this->assertEquals(
'fallback', $skin->getSkinName(),
'Default' );
62 $this->assertEquals(
'testname', $skin->getSkinName(),
'Constructor argument' );
71 $callback =
function () {
74 $factory->register(
'skin1',
'Skin1', $callback );
75 $factory->register(
'skin2',
'Skin2', $callback );
76 $names = $factory->getSkinNames();
77 $this->assertArrayHasKey(
'skin1', $names );
78 $this->assertArrayHasKey(
'skin2', $names );
79 $this->assertEquals(
'Skin1', $names[
'skin1'] );
80 $this->assertEquals(
'Skin2', $names[
'skin2'] );
testMakeSkinWithValidCallback()
SkinFactory::makeSkin.
testMakeSkinWithNoBuilders()
SkinFactory::makeSkin.
testGetSkinNames()
SkinFactory::getSkinNames.
testGetSkinName()
Skin::__construct Skin::getSkinName.
testMakeSkinWithInvalidCallback()
SkinFactory::makeSkin.
testRegister()
SkinFactory::register.
Factory class to create Skin objects.
SkinTemplate class for the fallback skin.