Ejemplo n.º 1
0
 public function testMultiContentSelectors()
 {
     $context = new Context('baz');
     $context->setContent(array('foo' => 'bar', 'one' => 'two'));
     $this->assertTrue($context->applies('baz[foo=bar][one=two]'));
     $this->assertFalse($context->applies('baz[foo=bar][one=three]'));
     $this->assertFalse($context->applies('baz[foo=baz][one=two]'));
 }
Ejemplo n.º 2
0
 public function testNoContentRendersEmpty()
 {
     $decorator = new Content('{baz}');
     $context = new Context();
     $context->setContent('foo', 'bar');
     $decorator->context($context);
     $expected = '';
     $actual = $decorator->render();
     $this->assertEquals($expected, $actual);
 }
Ejemplo n.º 3
0
 public function testComputedTags()
 {
     $context = new Context('foo');
     $context->setContent(array('one' => 'value', 'two' => '', 'three' => 'value'));
     $context->select('sub')->add('content', array('computedTags' => true));
     $decorator = new Contexts(array('name' => 'sub', 'separator' => ';'));
     $decorator->context($context);
     $actual = $decorator->render();
     $expected = 'first,even;empty,odd;last,even;';
     $this->assertEquals($expected, $actual);
 }
Ejemplo n.º 4
0
 public function testSimple()
 {
     $context = new MainContext('foo');
     $context->add('dummy');
     $context->setContent(array('one', 'two'));
     $decorator = new Contexts('foo');
     $decorator->context($context);
     $actual = $decorator->render();
     $expected = 'dummy()dummy()';
     $this->assertEquals($actual, $expected);
 }