/** * @see CreditCardEntity::toArray() */ public function testToArray() { $entity = array('number' => str_repeat(rand(1, 9), 4) . str_repeat(rand(1, 9), 4) . str_repeat(rand(1, 9), 4) . str_repeat(rand(1, 9), 4), 'securityCode' => rand(1, 9) . rand(1, 9) . rand(1, 9), 'expirationDate' => rand(1, 9) . rand(1, 9) . rand(1, 9) . rand(1, 9) . '/' . rand(1, 9) . rand(1, 9), 'name' => 'person name ' . rand(1, 9) . rand(1, 9) . rand(1, 9)); $this->object->setNumber($entity['number'])->setSecurityCode($entity['securityCode'])->setExpirationDate($entity['expirationDate'])->setName($entity['name']); $rs = $this->object->toArray(); $this->assertSame($entity, $rs); }
/** * Generate arry order. * @return array */ public function toArray() { return array('expiration' => $this->expiration, 'type' => $this->type, 'paymentMethod' => $this->paymentMethod, 'paymentCountry' => $this->paymentCountry, 'ipAddress' => $this->ipAddress, 'cookie' => $this->cookie, 'userAgent' => $this->userAgent, 'order' => $this->order->toArray(), 'creditCard' => $this->creditCard->toArray(), 'payer' => $this->payer->toArray(), 'extraParameters' => $this->extraParameters->toArray()); }
/** * @see TransactionEntity::setCreditCard() */ public function testSetCreditCard() { $creditCardEntity = new CreditCardEntity(); $number = str_repeat(rand(1, 9), 4) . str_repeat(rand(1, 9), 4) . str_repeat(rand(1, 9), 4) . str_repeat(rand(1, 9), 4); $creditCardEntity->setNumber($number); $securityCode = rand(1, 9) . rand(1, 9) . rand(1, 9); $creditCardEntity->setSecurityCode($securityCode); $expirationDate = rand(1, 9) . rand(1, 9) . rand(1, 9) . rand(1, 9) . '/' . rand(1, 9) . rand(1, 9); $creditCardEntity->setExpirationDate($expirationDate); $name = 'person name ' . rand(1, 9) . rand(1, 9) . rand(1, 9); $creditCardEntity->setName($name); $rs = $this->object->setCreditCard($creditCardEntity); $this->assertInstanceOf('\\PayU\\Entity\\Transaction\\TransactionEntity', $rs); $rs = $this->object->getCreditCard(); $this->assertInstanceOf('PayU\\Entity\\Transaction\\CreditCardEntity', $rs); $this->assertEquals($number, $rs->getNumber()); $this->assertEquals($securityCode, $rs->getSecurityCode()); $this->assertEquals($expirationDate, $rs->getExpirationDate()); $this->assertEquals($name, $rs->getName()); }