Skip to content

Commit

Permalink
Add TestFixtures class
Browse files Browse the repository at this point in the history
  • Loading branch information
webeweb committed Aug 13, 2018
1 parent 11f0bd9 commit 53ac278
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions Tests/Fixtures/App/TestFixtures.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php

/**
* This file is part of the haveibeenpwned-library package.
*
* (c) 2018 WEBEWEB
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace WBW\Library\HaveIBeenPwned\Tests\Fixtures\App;

use WBW\Library\Core\Helper\Argument\StringHelper;

/**
* Test fixtures.
*
* @author webeweb <https://github.com/webeweb/>
* @package WBW\Library\HaveIBeenPwned\Tests\Fixtures\App
* @final
*/
final class TestFixtures {

/**
* Sample breach response.
*
* @var string
*/
const SAMPLE_BREACH_RESPONSE = <<<'EOTXT'
[
{
"Name":"Adobe",
"Title":"Adobe",
"Domain":"adobe.com",
"BreachDate":"2013-10-04",
"AddedDate":"2013-12-04T00:00Z",
"ModifiedDate":"2013-12-04T00:00Z",
"PwnCount":152445165,
"Description":"In October 2013, 153 million Adobe accounts were breached with each containing an internal ID, username, email, <em>encrypted</em> password and a password hint in plain text. The password cryptography was poorly done and <a href=\"http://stricture-group.com/files/adobe-top100.txt\" target=\"_blank\" rel=\"noopener\">many were quickly resolved back to plain text</a>. The unencrypted hints also <a href=\"http://www.troyhunt.com/2013/11/adobe-credentials-and-serious.html\" target=\"_blank\" rel=\"noopener\">disclosed much about the passwords</a> adding further to the risk that hundreds of millions of Adobe customers already faced.",
"DataClasses":["Email addresses","Password hints","Passwords","Usernames"],
"IsVerified":True,
"IsSensitive":False,
"IsRetired":False,
"IsSpamList":False
},
{
"Name":"BattlefieldHeroes",
"Title":"Battlefield Heroes",
"Domain":"battlefieldheroes.com",
"BreachDate":"2011-06-26",
"AddedDate":"2014-01-23T13:10Z",
"ModifiedDate":"2014-01-23T13:10Z",
"PwnCount":530270,
"Description":"In June 2011 as part of a final breached data dump, the hacker collective &quot;LulzSec&quot; <a href=\"http://www.rockpapershotgun.com/2011/06/26/lulzsec-over-release-battlefield-heroes-data\" target=\"_blank\" rel=\"noopener\">obtained and released over half a million usernames and passwords from the game Battlefield Heroes</a>. The passwords were stored as MD5 hashes with no salt and many were easily converted back to their plain text versions.",
"DataClasses":["Passwords","Usernames"],
"IsVerified":True,
"IsSensitive":False,
"IsRetired":False,
"IsSpamList":False
}
]
EOTXT;

/**
* Get a sample breach response.
*
* @return array Returns a sample breach response.
*/
public static function getSampleBreachResponse() {

// Clean the response.
$cleanResponse = StringHelper::replace(self::SAMPLE_BREACH_RESPONSE, [":True", ":False"], [":true", ":false"]);

// Return the response.
return json_decode($cleanResponse, true);
}

}

0 comments on commit 53ac278

Please sign in to comment.