Exemple #1
0
 public function testRemoveLabels_DelegatesToClient()
 {
     $expected = $this->node;
     $expected->setId(123);
     $matched = false;
     $label = new Label($this->client, 'FOOBAR');
     $this->client->expects($this->once())->method('removeLabels')->will($this->returnCallback(function (Node $actual, $labels) use($expected, $label, &$matched) {
         $matched = $expected->getId() == $actual->getId();
         $matched = $matched && $label->getName() == $labels[0]->getName();
         return array($label);
     }));
     $labels = $this->node->removeLabels(array($label));
     $this->assertEquals(1, count($labels));
     $this->assertSame($label, $labels[0]);
 }
Exemple #2
0
 /**
  * @dataProvider dataProvider_ValidNames
  */
 public function testContruct_ValidNameGiven_SetsNameCastAsString($name)
 {
     $label = new Label($this->client, $name);
     self::assertEquals($name, $label->getName());
     self::assertInternalType('string', $label->getName());
 }
$methods = $result['items'];
foreach ($methods as $m) {
    $o = new ContactMethod();
    $o->setName($m);
    $o->save();
    echo "ContactMethod: {$o->getName()}\n";
}
$result = $mongo->lookups->findOne(array('name' => 'types'));
$types = $result['items'];
foreach ($types as $t) {
    $o = new IssueType();
    $o->setName($t);
    $o->save();
    echo "IssueType: {$o->getName()}\n";
}
$result = $mongo->lookups->findOne(array('name' => 'labels'));
$labels = $result['items'];
foreach ($labels as $l) {
    $o = new Label();
    $o->setName($l);
    $o->save();
    echo "Label: {$o->getName()}\n";
}
$result = $mongo->categoryGroups->find();
foreach ($result as $r) {
    $o = new CategoryGroup();
    $o->setName($r['name']);
    $o->setOrdering($r['order']);
    $o->save();
    echo "CategoryGroup: {$o->getName()}\n";
}