Skip to content

Instantly share code, notes, and snippets.

@andreybolonin
Created December 29, 2016 23:27
Show Gist options
  • Save andreybolonin/27325ba3cad1359a8b3ded440869556a to your computer and use it in GitHub Desktop.
Save andreybolonin/27325ba3cad1359a8b3ded440869556a to your computer and use it in GitHub Desktop.
<?php
namespace UmberFirm\Bundle\CustomerBundle\Tests\Unit\Entity;
use DateTime;
use UmberFirm\Bundle\CommonBundle\Entity\Gender;
use UmberFirm\Bundle\CustomerBundle\Entity\Customer;
use UmberFirm\Bundle\CustomerBundle\Entity\CustomerProfile;
/**
* Class CustomerProfileTest
*
* @package UmberFirm\Bundle\CustomerBundle\Tests\Unit
*/
class CustomerProfileTest extends \PHPUnit_Framework_TestCase
{
/**
* @var CustomerProfile
*/
private $customerProfile;
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
$this->customerProfile = new CustomerProfile();
}
public function testDefaultCustomer()
{
$this->assertInstanceOf(CustomerProfile::class, $this->customerProfile->setCustomer());
$this->assertEquals(null, $this->customerProfile->getCustomer());
}
public function testCustomer()
{
$this->assertInstanceOf(CustomerProfile::class, $this->customerProfile->setCustomer(new Customer));
$this->assertInstanceOf(Customer::class, $this->customerProfile->getCustomer());
}
public function testFirstName()
{
$this->assertInstanceOf(CustomerProfile::class, $this->customerProfile->setFirstname('John'));
$this->assertEquals('John', $this->customerProfile->getFirstname());
$this->assertInternalType('string', $this->customerProfile->getFirstname());
}
public function testLastName()
{
$this->assertInstanceOf(CustomerProfile::class, $this->customerProfile->setLastname('Doe'));
$this->assertEquals('Doe', $this->customerProfile->getLastname());
$this->assertInternalType('string', $this->customerProfile->getLastname());
}
public function testBirthday()
{
$this->assertInstanceOf(CustomerProfile::class, $this->customerProfile->setBirthday(new DateTime));
$this->assertInstanceOf(DateTime::class, $this->customerProfile->getBirthday());
}
public function testDefaultGender()
{
$this->assertInstanceOf(CustomerProfile::class, $this->customerProfile->setGender());
$this->assertEquals(null, $this->customerProfile->getGender());
}
public function testGender()
{
$this->assertInstanceOf(CustomerProfile::class, $this->customerProfile->setGender(new Gender));
$this->assertInstanceOf(Gender::class, $this->customerProfile->getGender());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment