public function testNotExists()
 {
     $arrayAccess = $this->getArrayAccessor();
     $this->tester->assertExceptionThrown('WebChemistry\\Parameters\\ParameterNotExistsException', function () use($arrayAccess) {
         $arrayAccess['notExists']->asd = NULL;
     });
 }
Example #2
0
 public function testCreateWithoutFactory()
 {
     $factory = new \WebChemistry\Forms\Factory\Container();
     $this->tester->assertExceptionThrown('WebChemistry\\Forms\\FormException', function () use($factory) {
         $factory->create();
     });
 }
Example #3
0
 public function testForm()
 {
     $ctrl = $this->ctrl;
     $this->assertInstanceOf('WebChemistry\\Forms\\Form', $this->ctrl->createMyForm());
     $this->tester->assertExceptionThrown('Nette\\InvalidStateException', function () use($ctrl) {
         $ctrl->getPresenter();
     });
     $this->tester->assertExceptionThrown('Nette\\InvalidStateException', function () use($ctrl) {
         $ctrl->flashMessage('flash');
     });
 }
Example #4
0
 public function testPrice()
 {
     $this->tester->assertExceptionThrown('WebChemistry\\ThePay\\InvalidArgumentException', function () {
         $this->thePay->createSender('test');
     });
     $this->tester->assertExceptionThrown('WebChemistry\\ThePay\\InvalidArgumentException', function () {
         $this->thePay->createSender(['test']);
     });
     $this->assertSame(400.0, $this->thePay->createSender(400)->getValue());
     $this->assertSame(400.0, $this->thePay->createSender('400')->getValue());
 }
Example #5
0
 public function testPrice()
 {
     $receiver = $this->getReceiver(['value' => 'string']);
     $this->assertFalse($receiver->verifySignature(FALSE));
     $this->tester->assertExceptionThrown(\WebChemistry\ThePay\ThePayException::class, function () use($receiver) {
         $receiver->verifySignature();
     });
 }
Example #6
0
 public function testResetEventsArray()
 {
     $form = new Form();
     $form->onSuccess[] = function () {
     };
     $form->onSuccess[] = function () {
     };
     $form->onSubmit[] = function () {
     };
     $form->onError[] = function () {
     };
     $form->onError[] = function () {
     };
     $form->resetEvents(['onSuccess', 'onSubmit']);
     $this->assertSame(array(), $form->onSuccess);
     $this->assertSame(array(), $form->onSubmit);
     $this->assertCount(2, $form->onError);
     $this->tester->assertExceptionThrown('Nette\\InvalidArgumentException', function () use($form) {
         $form->resetEvents('onNotExists');
     });
 }