public function testCreate() { $bxObject = m::mock('object'); $bxObject->shouldReceive('add')->with(['NAME' => 'John Doe'])->once()->andReturn(3); TestUser::$bxObject = $bxObject; $newTestUser = TestUser::create(['NAME' => 'John Doe']); $this->assertSame(3, $newTestUser->id); $this->assertSame(['NAME' => 'John Doe', 'ID' => 3], $newTestUser->fields); }