public function testCtor() { $account = new AccountObject(); $this->assertNull($account->getId()); $this->assertNull($account->getType()); $accountProvider = new BalanceObject(); $accountProvider->setId('foo'); $accountProvider->setType('baz'); $account = new AccountObject($accountProvider); $this->assertSame($accountProvider->getId(), $account->getId()); $this->assertSame($accountProvider->getType(), $account->getType()); }
public function testEqualTo() { $accountA = new ExchangeAccountObject(); $accountA->setType('ExchangeAccount'); $accountB = new ExchangeAccountObject(); $accountB->setType('ExchangeAccount'); $this->assertTrue($accountA->equalTo($accountA)); $this->assertTrue($accountA->equalTo($accountB)); $accountC = new AccountObject(); $accountC->setType('ExchangeAccount'); $this->assertFalse($accountB->equalTo($accountC)); }
public function testEqualTo() { $accountA = new AccountObject(); $accountA->setId('A')->setType('Foo'); $accountB = new AccountObject(); $accountB->setId('B')->setType('Foo'); /* @var $traitObject AccountTrait */ $traitObject = $this->traitObject; $traitObject->setId('A'); $this->traitObject->expects($this->atLeastOnce())->method('getType')->willReturn('Foo'); $this->assertTrue($traitObject->equalTo($accountA)); $this->assertFalse($traitObject->equalTo($accountB)); }