addField() public method

public addField ( Bolt\Storage\Field\FieldInterface $field )
$field Bolt\Storage\Field\FieldInterface
Example #1
0
 public function testAddingFetchingfields()
 {
     $field = $this->getMock('Bolt\\Storage\\Field\\Base', null, ['test', 'test.twig']);
     $manager = new Manager();
     $manager->addField($field);
     $this->assertTrue($manager->has('test'));
     $this->assertEquals($field, $manager->getField('test'));
     $this->assertFalse($manager->getField('nonexistent'));
     $this->assertGreaterThan(5, $manager->fields());
 }
Example #2
0
 public function testAddingFetchingfields()
 {
     /** @var Base $field */
     $field = $this->getMockBuilder(Base::class)->setMethods(null)->setConstructorArgs(['test', 'test.twig'])->getMock();
     $manager = new Manager();
     $manager->addField($field);
     $this->assertTrue($manager->has('test'));
     $this->assertEquals($field, $manager->getField('test'));
     $this->assertFalse($manager->getField('nonexistent'));
     $this->assertGreaterThan(5, $manager->fields());
 }