Example #1
0
 public function testPkiPadding()
 {
     if (!extension_loaded('openssl')) {
         $this->markTestSkipped('The openssl extension is not loaded.');
     }
     try {
         $obj = new Zend_InfoCard_Cipher_Pki_Adapter_Rsa("thiswillbreak");
         $this->fail("Exception not thrown as expected");
     } catch (Exception $e) {
         /* yay */
     }
     $obj = new Zend_InfoCard_Cipher_Pki_Adapter_Rsa();
     $prv_key = file_get_Contents(dirname(__FILE__) . "/_files/ssl_private.cert");
     try {
         $obj->decrypt("Foo", $prv_key, null, "foo");
         $this->fail("Expected Exception Not Thrown");
     } catch (Exception $e) {
         /* yay */
     }
     $result = $obj->decrypt("foo", $prv_key, null, Zend_InfoCard_Cipher_Pki_Adapter_Abstract::NO_PADDING);
     // This is sort of werid, but since we don't have a real PK-encrypted string to test against for NO_PADDING
     // mode we decrypt the string "foo" instead. Mathmatically we will always arrive at the same resultant
     // string so if our hash doesn't match then something broke.
     $this->assertSame(md5($result), "286c1991e1f7040229a6f223065b91b5");
 }
Example #2
0
 public function testPkiPaddingWithThrowExceptionOnBadInput2()
 {
     if (!extension_loaded('openssl')) {
         $this->markTestSkipped('The openssl extension is not loaded.');
     }
     $obj = new Adapter\RSA();
     $prv_key = file_get_Contents(__DIR__ . "/_files/ssl_private.cert");
     try {
         $obj->decrypt("Foo", $prv_key, null, "foo");
         $this->fail("Expected Exception Not Thrown");
     } catch (\Exception $e) {
         /* yay */
     }
 }
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('Generate the full structure of a new module for Backbone / RequireJS');
// Make sure that we're dealing with a clean directory
$I->cleanDir('tests/tmp');
$I->runShellCommand('php ../../../artisan modules:generate taco --path=tests/tmp/modules');
$I->seeInShellOutput('Successfully created 4 files');
$I->openFile('tests/tmp/modules/tacos/models/taco.js');
$I->seeFileContentsEqual(file_get_Contents('tests/acceptance/stubs/model.stub'));
$I->openFile('tests/tmp/modules/tacos/collections/tacos.js');
$I->seeFileContentsEqual(file_get_Contents('tests/acceptance/stubs/collection.stub'));
$I->openFile('tests/tmp/modules/tacos/views/taco_view.js');
$I->seeFileContentsEqual(file_get_Contents('tests/acceptance/stubs/view.stub'));
$I->openFile('tests/tmp/modules/tacos/index.js');
$I->seeFileContentsEqual(file_get_Contents('tests/acceptance/stubs/index.stub'));
$I->cleanDir('tests/tmp');