Пример #1
0
 /**
  * (non-PHPdoc)
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 public function setUp()
 {
     parent::setUp();
     $expAddress = new Address();
     $expAddress->setLine2('Address Line 2');
     $expAddress->setPostalCode('34000');
     $expAddress->setCity('City');
     $destAddress = new AddressDest();
     $destAddress->setName('Name');
     $destAddress->setSurname('Surname');
     $destAddress->setEmail('*****@*****.**');
     $destAddress->setLine2('Address Line 2');
     $destAddress->setPostalCode('34000');
     $destAddress->setCity('City');
     $this->context = new ServiceCallContext('ACME');
     $this->parcel = new Parcel(0.72);
     $this->expEnv = new ExpEnv($expAddress);
     $this->destEnv = new DestEnv($destAddress);
     $this->letter = new Letter();
     $this->letter->setContractNumber('111111');
     $this->letter->setPassword('password');
     $this->letter->setService($this->context);
     $this->letter->setParcel($this->parcel);
     $this->letter->setExp($this->expEnv);
     $this->letter->setDest($this->destEnv);
     $this->letter->setProfil(null);
 }
Пример #2
0
 /**
  * Test a valid minimal object
  *
  * @depends testEmptyObject
  */
 public function testMinimalObject(AddressDest $address)
 {
     $address->setLine2('Place de la Comedie');
     $address->setPostalCode('34000');
     $address->setCity('Montpellier');
     $address->setName('Name');
     $address->setSurname('Surname');
     $address->setEmail('*****@*****.**');
     $this->validateObject($address, array());
 }
Пример #3
0
use WSColissimo\WSColiPosteLetterService\Util\ServiceAvailability;
use Symfony\Component\Validator\Validation;
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/parameters.php';
// build the sender address
$expAddress = new Address();
$expAddress->setCompanyName('Acme and Co');
$expAddress->setLine2('Place de la Comedie');
$expAddress->setPostalCode('34000');
$expAddress->setCity('Montpellier');
// build the recipient address
$destAddress = new AddressDest();
$destAddress->setCivility('M');
$destAddress->setName('Prenom');
$destAddress->setSurname('Nom');
$destAddress->setLine2('Place de la Comedie');
$destAddress->setPostalCode('34000');
$destAddress->setCity('Montpellier');
$destAddress->setPhone('0606060606');
$destAddress->setEmail('*****@*****.**');
// build the main letter object
$letter = new Letter();
$letter->setContractNumber($parameters['account']);
$letter->setPassword($parameters['password']);
$letter->setService(new ServiceCallContext('Acme and Co'));
$letter->setParcel(new Parcel(0.72));
$letter->setExp(new ExpEnv($expAddress));
$letter->setDest(new DestEnv($destAddress));
// test service availability // optionnal
$checker = new ServiceAvailability();
$checker->check();