コード例 #1
0
 public function testCreate()
 {
     $bxObject = m::mock('object');
     $bxObject->shouldReceive('add')->with(['NAME' => 'John Doe'])->once()->andReturn(2);
     TestElement::$bxObject = $bxObject;
     $newElement = TestElement::create(['NAME' => 'John Doe']);
     $this->assertSame(2, $newElement->id);
     $this->assertSame(['NAME' => 'John Doe', 'ID' => 2], $newElement->fields);
 }