public function testIsModifiedBypass()
 {
     $dataObjectMock = $this->getMockBuilder('Magento\\Framework\\DataObject')->disableOriginalConstructor()->setMethods(['getId', 'getData'])->getMock();
     $dataObjectMock->expects($this->any())->method('getId')->willReturn(null);
     $dataObjectMock->expects($this->once())->method('getData')->willReturn(['is_billing_address' => 1]);
     $this->metadataMock->expects($this->once())->method('getFields')->with($dataObjectMock)->willReturn(['is_billing_address' => null]);
     $this->model->registerSnapshot($dataObjectMock);
     $this->assertEquals(true, $this->model->isModified($dataObjectMock));
 }
 public function testGetFields()
 {
     $mainTable = 'main_table';
     $expectedDescribedTable = ['described_table' => null];
     $this->resource->expects($this->any())->method('getMainTable')->willReturn($mainTable);
     $this->connection->expects($this->once())->method('describeTable')->with($mainTable)->willReturn($expectedDescribedTable);
     $this->assertEquals($expectedDescribedTable, $this->entityMetadata->getFields($this->model));
     //get from cached
     $this->connection->expects($this->never())->method('describeTable');
     $this->assertEquals($expectedDescribedTable, $this->entityMetadata->getFields($this->model));
 }