Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/dev/master'
- Loading branch information
Showing
9 changed files
with
192 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
CalendarCRM | ||
=========== | ||
# OroCalendarCRMBridgeBundle | ||
|
||
What is CalendarCRM? | ||
------------ | ||
OroCalendarCRMBridgeBundle is a bridge that integrates features of the [OroCalendarBundle](https://github.com/oroinc/OroCalendarBundle) into OroCRM applications. | ||
|
||
CalendarCRM is a bridge that integrates certain CRM related features of the OroCalendarBundle into CRM applications. | ||
The bundle enables the Calendar Events [activity](https://github.com/oroinc/platform/tree/master/src/Oro/Bundle/ActivityBundle) for the Contact, Case, Account, Magento Customer, Order, Lead, Opportunity, B2bCustomer entities, and enables users to create Calendar Events from the pages of these entities with the appropriate prefilled event context. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# OroCallCRMBridgeBundle | ||
|
||
OroCallCRMBridgeBundle enables Calls contact [activity](https://github.com/oroinc/platform/tree/master/src/Oro/Bundle/ActivityBundle) for Account, Calendar, Case, ContactUs Request, Magento Customer, Magento Order, Magento Cart, Sales Lead, Sales Opportunity, B2bCustomer entities. | ||
|
||
The bundle enables Oro application users to log Call events from the pages of these entities. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# OroCustomerPortalCRMBridgeBundle | ||
|
||
OroCustomerPortalCRMBridgeBundle integrates OroCRM features with OroCommerce user roles and enables Oro application users with the ROLE_ACCOUNT_MANAGER role to manage all application Account and Contact entity records. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
MarketingCRM | ||
=========== | ||
# OroMarketingCRMBridgeBundle | ||
|
||
What is MarketingCRM? | ||
------------ | ||
OroMarketingCRMBridgeBundle is aimed at integrating features of marketing package into OroCRM applications. | ||
|
||
MarketingCRM is a bridge that integrates certain CRM related features of the marketing package | ||
(CampaignBundle, MarketingListBundle, TrackingBundle) into CRM applications. | ||
The bundle adds widgets with the statistics of customer visits to the Account and Customer view pages, if the tracking [feature](https://github.com/oroinc/platform/tree/master/src/Oro/Bundle/FeatureToggleBundle) is enabled in Oro application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# OroTaskCRMBridgeBundle | ||
|
||
OroTaskCRMBridgeBundle enables the task [activity](https://github.com/oroinc/platform/tree/master/src/Oro/Bundle/ActivityBundle) for Account, Contact, Sales Lead, Sales Opportunity, Sales B2BCustomer, Case, Magento Customer, Magento Order entities. The bundle enables users to create Tasks from the view pages of these entities with correct prefilled context. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
src/Oro/Bundle/MagentoBundle/Tests/Unit/Provider/Customer/AccountProviderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
|
||
namespace Oro\Bundle\MagentoBundle\Tests\Unit\Provider\Customer; | ||
|
||
use Doctrine\Common\Persistence\ManagerRegistry; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
use Doctrine\ORM\Mapping\ClassMetadataInfo; | ||
use Oro\Bundle\AccountBundle\Entity\Account; | ||
use Oro\Bundle\ImportExportBundle\Strategy\Import\NewEntitiesHelper; | ||
use Oro\Bundle\MagentoBundle\Entity\Customer; | ||
use Oro\Bundle\MagentoBundle\Provider\Customer\AccountProvider; | ||
use Oro\Bundle\MagentoBundle\Service\AutomaticDiscovery; | ||
|
||
class AccountProviderTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** @var AutomaticDiscovery|\PHPUnit_Framework_MockObject_MockObject */ | ||
private $automaticDiscovery; | ||
|
||
/** @var NewEntitiesHelper|\PHPUnit_Framework_MockObject_MockObject */ | ||
private $newEntitiesHelper; | ||
|
||
/** @var AccountProvider */ | ||
private $provider; | ||
|
||
protected function setUp() | ||
{ | ||
$this->automaticDiscovery = $this->createMock(AutomaticDiscovery::class); | ||
$this->newEntitiesHelper = $this->createMock(NewEntitiesHelper::class); | ||
|
||
$this->provider = new AccountProvider( | ||
$this->newEntitiesHelper, | ||
$this->automaticDiscovery, | ||
$this->getDoctrineMock() | ||
); | ||
} | ||
|
||
public function testGetAccountForUnsupportedCustomer() | ||
{ | ||
$targetCustomer = new \stdClass(); | ||
|
||
$this->assertNull($this->provider->getAccount($targetCustomer)); | ||
} | ||
|
||
public function testGetAccountForCustomerWithAccount() | ||
{ | ||
$account = new Account(); | ||
|
||
$targetCustomer = new Customer(); | ||
$targetCustomer->setAccount($account); | ||
|
||
$this->assertSame($account, $this->provider->getAccount($targetCustomer)); | ||
} | ||
|
||
public function testGetAccount() | ||
{ | ||
$targetCustomer = new Customer(); | ||
$targetCustomer->setFirstName('Too long first name for Account'); | ||
$targetCustomer->setLastName('Too long last name for Account'); | ||
|
||
$account = $this->provider->getAccount($targetCustomer); | ||
|
||
$this->assertInstanceOf(Account::class, $account); | ||
$this->assertEquals('Too long first name for Account Too long l', $account->getName()); | ||
} | ||
|
||
public function testGetAccountNameComposition() | ||
{ | ||
$targetCustomer = new Customer(); | ||
$targetCustomer->setFirstName('First Name'); | ||
$targetCustomer->setLastName(''); | ||
|
||
$this->assertEquals('First Name', $this->provider->getAccount($targetCustomer)->getName()); | ||
|
||
$targetCustomer->setFirstName(''); | ||
$targetCustomer->setLastName(' Last Name '); | ||
$this->assertEquals('Last Name', $this->provider->getAccount($targetCustomer)->getName()); | ||
} | ||
|
||
/** | ||
* @return ManagerRegistry|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private function getDoctrineMock() | ||
{ | ||
$metadata = $this->createMock(ClassMetadataInfo::class); | ||
$metadata->expects($this->any()) | ||
->method('getFieldMapping') | ||
->with('name') | ||
->willReturn(['length' => 42]); | ||
|
||
$manager = $this->createMock(ObjectManager::class); | ||
$manager->expects($this->any()) | ||
->method('getClassMetadata') | ||
->with(Account::class) | ||
->willReturn($metadata); | ||
|
||
$registry = $this->createMock(ManagerRegistry::class); | ||
$registry->expects($this->any()) | ||
->method('getManagerForClass') | ||
->with(Account::class) | ||
->willReturn($manager); | ||
|
||
return $registry; | ||
} | ||
} |