private function checkUsername($username) { $badCharacters = array(',', ';', '@', '"', '\'', '%', '*', '&'); foreach ($badCharacters as $character) { if (stripos($username, $character) !== false) { return 0; } } if (\classes\User::getUserByUsername($username) !== false) { return 0; } return 1; }
public function testCreatingKeys() { // Check to see if PGP Creation is working $result = \classes\Encryption::createPGPKey('test', 'test'); $this->assertTrue($result); // Verify the key was written. $user = \classes\User::getUserByUsername('test'); $this->assertNotNull($user->getPublickey()); $this->assertNotNull($user->getPrivatekey()); // Verify tmp files were cleaned up. $this->assertFalse(file_exists('/tmp/test')); $this->assertFalse(file_exists('/tmp/test.pub')); $this->assertFalse(file_exists('/tmp/test.sec')); }
<?php require_once __DIR__ . '/autoload.php'; // Namespaces alias //use \Classes\Job; use Classes\User; use Classes\Subclasses\Car; $job = new \Classes\Job(); echo $job->getCompagny(); $user = new User(); echo $user->getCompagny(); $car = new Car(); echo $car->getName();