public function testRequiredFields() { $user = $this->createUser(); $entity = new Wallet(); $entity->setOwners(array($user->getID())); $entity->setTag('tag'); $entity->setName('wallet'); $entity->setDescription('mangopay wallet'); $entity->setRaisingGoalAmount(100); $entity->setContributionLimitDate(new \DateTime('+1 year')); $response = $this->getClient()->request(new CreateWallet($entity)); $this->assertInstanceOf('Gordalina\\Mangopay\\Response\\ResponseInterface', $response); $this->assertTrue($response->isSuccessful()); $responseEntity = $response->getModel(); $this->assertFalse($entity === $responseEntity); $this->assertSame($entity->getOwners(), $responseEntity->getOwners()); $this->assertSame($entity->getTag(), $responseEntity->getTag()); $this->assertSame($entity->getName(), $responseEntity->getName()); $this->assertSame($entity->getDescription(), $responseEntity->getDescription()); $this->assertSame($entity->getRaisingGoalAmount(), $responseEntity->getRaisingGoalAmount()); $this->assertSame($entity->getContributionLimitDate(), $responseEntity->getContributionLimitDate()); $this->assertSame(0, $responseEntity->getCollectedAmount()); $this->assertSame(0, $responseEntity->getSpentAmount()); $this->assertSame(0, $responseEntity->getAmount()); }
/** * @param User $user defaults to null * @return Wallet */ protected function createWallet($user = null) { if ($user === null) { $user = $this->createUser(); } $entity = new Wallet(); $entity->setOwners(array($user->getID())); $entity->setTag('tag'); $entity->setName('wallet'); $entity->setDescription('mangopay wallet'); $entity->setRaisingGoalAmount(100); $entity->setContributionLimitDate(new \DateTime('+1 year')); $response = $this->getClient()->request(new CreateWallet($entity)); $this->assertInstanceOf('Gordalina\\Mangopay\\Response\\ResponseInterface', $response); $this->assertTrue($response->isSuccessful()); return $response->getModel(); }