Пример #1
0
 public function testWriteMinimalChanges()
 {
     $transportSetting = $this->getMock('Oro\\Bundle\\IntegrationBundle\\Entity\\Transport');
     $channel = new Channel();
     $channel->getSynchronizationSettingsReference()->offsetSet('syncPriority', TwoWaySyncConnectorInterface::LOCAL_WINS);
     $channel->setTransport($transportSetting);
     $customer = new Customer();
     $customer->setChannel($channel);
     $customer->setFirstName(self::TEST_CUSTOMER_FIRSTNAME);
     $customer->setLastName(self::TEST_CUSTOMER_LASTNAME);
     $customer->setOriginId(self::TEST_CUSTOMER_ID);
     $self = $this;
     $this->transport->expects($this->once())->method('init');
     $this->em->expects($this->once())->method('flush');
     $this->em->expects($this->once())->method('persist')->will($this->returnCallback(function (Customer $customer) use($self) {
         $self->assertEquals($customer->getFirstName(), self::TEST_FIRSTNAME);
         $self->assertEquals($customer->getLastName(), self::TEST_LASTNAME);
     }));
     $this->transport->expects($this->once())->method('call')->with($this->equalTo(SoapTransport::ACTION_CUSTOMER_UPDATE), $this->equalTo(['customerId' => self::TEST_CUSTOMER_ID, 'customerData' => ['firstname' => self::TEST_FIRSTNAME, 'lastname' => self::TEST_LASTNAME]]));
     $data = [];
     array_push($data, (object) ['entity' => $customer, 'object' => ['first_name' => self::TEST_FIRSTNAME, 'last_name' => self::TEST_LASTNAME]]);
     $this->writer->write($data);
 }