public function testDelete() { $application = \Stormpath\Resource\Application::instantiate(array('name' => makeUniqueName('AccountStoreMappingTest Test Delete'))); self::createResource(\Stormpath\Resource\Application::PATH, $application); $accountStoreMappingWithDir = \Stormpath\Resource\AccountStoreMapping::create(array('accountStore' => self::$directory, 'application' => $application)); $href = $accountStoreMappingWithDir->href; $accountStoreMapping = \Stormpath\Resource\AccountStoreMapping::get($href); $this->assertInstanceOf('Stormpath\\Resource\\AccountStoreMapping', $accountStoreMapping); $this->assertInstanceOf('Stormpath\\Resource\\Directory', $accountStoreMapping->accountStore); $accountStoreMapping->delete(); try { \Stormpath\Resource\AccountStoreMapping::get($href); $application->delete(); $this->fail('Should have thrown a ResourceError.'); } catch (\Stormpath\Resource\ResourceError $re) { $this->assertTrue(true); } $application->delete(); }
public function testSendVerificationEmail() { $application = self::$application; $directory = \Stormpath\Resource\Directory::instantiate(array('name' => makeUniqueName('ApplicationTest testSendVerificationEmail'))); self::createResource(\Stormpath\Resource\Directory::PATH, $directory); \Stormpath\Resource\AccountStoreMapping::create(array('accountStore' => $directory, 'application' => $application)); // set directory policy to enable verification email workflow $policy = $directory->accountCreationPolicy; $policy->verificationEmailStatus = 'ENABLED'; $policy->save(); $this->assertEquals('ENABLED', $policy->verificationEmailStatus); $username = makeUniqueName('ApplicationTest sendVerificaiton'); $emailAddress = $username . '@unknown123.kot'; $account = Account::instantiate(array('givenName' => 'Account Name', 'middleName' => 'Middle Name', 'surname' => 'Surname', 'username' => $username, 'email' => $emailAddress, 'password' => 'superP4ss')); $result = $directory->createAccount($account); $this->assertEquals($username, $result->username); $this->assertEquals($emailAddress, $result->email); try { $application->sendVerificationEmail($username); } catch (ResourceError $re) { $this->fail("Send verification email failed: " . $re->getErrorCode() . " " . $re->getDeveloperMessage()); } try { $application->sendVerificationEmail($username); } catch (ResourceError $re) { $this->fail("Send verification email failed: " . $re->getErrorCode() . " " . $re->getDeveloperMessage()); } try { $application->sendVerificationEmail($username, array('accountStore' => $directory)); } catch (ResourceError $re) { $this->fail("Send verification email failed: " . $re->getErrorCode() . " " . $re->getDeveloperMessage()); } $directory->delete(); }