示例#1
0
 /**
  * @dataProvider hasProvider
  *
  * @covers ::has
  * @covers ::set
  *
  * @param array     $contents   An array of items to store, indexed by id
  * @param string    $id         The id to pass to ::has
  * @param boolean   $expected   The expected result of ::has($id)
  */
 public function testHas(array $contents, $id, $expected)
 {
     $container = new Container();
     foreach ($contents as $itemId => $item) {
         $container->set($itemId, $item);
     }
     $this->assertEquals($expected, $container->has($id));
 }
示例#2
0
文件: Getter.php 项目: choult/tote
 /**
  * {@inheritdoc}
  */
 public function has($id)
 {
     $getter = $this->getGetter($id);
     if (parent::has($id) || \method_exists($this, $getter)) {
         return true;
     }
     return false;
 }