You are here

public function MappedObjectTest::testPushCreate in Salesforce Suite 8.3

Same name and namespace in other branches
  1. 8.4 modules/salesforce_mapping/tests/src/Unit/MappedObjectTest.php \Drupal\Tests\salesforce_mapping\Unit\MappedObjectTest::testPushCreate()
  2. 5.0.x modules/salesforce_mapping/tests/src/Unit/MappedObjectTest.php \Drupal\Tests\salesforce_mapping\Unit\MappedObjectTest::testPushCreate()

@covers ::push

File

modules/salesforce_mapping/tests/src/Unit/MappedObjectTest.php, line 201

Class

MappedObjectTest
Test Mapped Object instantitation.

Namespace

Drupal\Tests\salesforce_mapping\Unit

Code

public function testPushCreate() {

  // Third pass: test create.
  $this->mapping
    ->expects($this
    ->once())
    ->method('hasKey')
    ->will($this
    ->returnValue(FALSE));
  $this->mapped_object
    ->expects($this
    ->any())
    ->method('sfid')
    ->willReturn(FALSE);
  $this->mapping
    ->expects($this
    ->any())
    ->method('alwaysUpsert')
    ->willReturn(FALSE);
  $this->client
    ->expects($this
    ->once())
    ->method('objectCreate')
    ->willReturn($this->sfid);
  $result = $this->mapped_object
    ->push();
  $this
    ->assertTrue($result instanceof SFID);
  $this
    ->assertEquals($this->salesforce_id, (string) $result);
}