-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
163 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php namespace info\keepass\unittest; | ||
|
||
use info\keepass\Entry; | ||
use info\keepass\ProtectedValue; | ||
use util\UUID; | ||
|
||
class EntryTest extends \unittest\TestCase { | ||
private $entry; | ||
|
||
/** @return void */ | ||
public function setUp() { | ||
$this->entry= [ | ||
'UUID' => 'fZhlFzAGRU24qsKpoxQ2Lg==', | ||
'IconID' => '42', | ||
'ForegroundColor' => null, | ||
'BackgroundColor' => null, | ||
'OverrideURL' => null, | ||
'Tags' => null, | ||
'Times' => '', | ||
'String' => [ | ||
'Notes' => 'Notes', | ||
'Password' => new ProtectedValue("\323\$c", "\274J\006"), | ||
'Title' => 'Entry #1', | ||
'URL' => 'http://example.com/', | ||
'UserName' => 'test' | ||
], | ||
'History' => [ | ||
] | ||
]; | ||
} | ||
|
||
#[@test] | ||
public function can_create() { | ||
new Entry($this->entry, '/Entry #1'); | ||
} | ||
|
||
#[@test] | ||
public function path() { | ||
$this->assertEquals('/Entry #1', (new Entry($this->entry, '/Entry #1'))->path()); | ||
} | ||
|
||
#[@test] | ||
public function uuid() { | ||
$this->assertEquals(new UUID('7d986517-3006-454d-b8aa-c2a9a314362e'), (new Entry($this->entry, '/Entry #1'))->uuid()); | ||
} | ||
|
||
#[@test] | ||
public function title() { | ||
$this->assertEquals('Entry #1', (new Entry($this->entry, '/Entry #1'))->title()); | ||
} | ||
|
||
#[@test] | ||
public function notes() { | ||
$this->assertEquals('Notes', (new Entry($this->entry, '/Entry #1'))->notes()); | ||
} | ||
|
||
#[@test] | ||
public function url() { | ||
$this->assertEquals('http://example.com/', (new Entry($this->entry, '/Entry #1'))->url()); | ||
} | ||
|
||
#[@test] | ||
public function username() { | ||
$this->assertEquals('test', (new Entry($this->entry, '/Entry #1'))->username()); | ||
} | ||
|
||
#[@test] | ||
public function password() { | ||
$this->assertEquals(new ProtectedValue("\323\$c", "\274J\006"), (new Entry($this->entry, '/Entry #1'))->password()); | ||
} | ||
|
||
#[@test] | ||
public function icon_field() { | ||
$this->assertEquals('42', (new Entry($this->entry, '/Entry #1'))->field('IconID')); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php namespace info\keepass\unittest; | ||
|
||
use info\keepass\Group; | ||
use util\UUID; | ||
|
||
class GroupTest extends \unittest\TestCase { | ||
private $group; | ||
|
||
/** @return void */ | ||
public function setUp() { | ||
$this->group= [ | ||
'UUID' => 'Vy28plCgw0u5Y0PtP2c/2Q==', | ||
'Name' => 'Test', | ||
'Notes' => 'Notes', | ||
'IconID' => '48', | ||
'Times' => '', | ||
'IsExpanded' => 'True', | ||
'DefaultAutoTypeSequence' => null, | ||
'EnableAutoType' => 'null', | ||
'EnableSearching' => 'null', | ||
'LastTopVisibleEntry' => 'AAAAAAAAAAAAAAAAAAAAAA==', | ||
]; | ||
} | ||
|
||
#[@test] | ||
public function can_create() { | ||
new Group($this->group, '/Test'); | ||
} | ||
|
||
#[@test] | ||
public function path() { | ||
$this->assertEquals('/Test', (new Group($this->group, '/Test'))->path()); | ||
} | ||
|
||
#[@test] | ||
public function uuid() { | ||
$this->assertEquals(new UUID('572dbca6-50a0-c34b-b963-43ed3f673fd9'), (new Group($this->group, '/Test'))->uuid()); | ||
} | ||
|
||
#[@test] | ||
public function name() { | ||
$this->assertEquals('Test', (new Group($this->group, '/Test'))->name()); | ||
} | ||
|
||
#[@test] | ||
public function notes() { | ||
$this->assertEquals('Notes', (new Group($this->group, '/Test'))->notes()); | ||
} | ||
|
||
#[@test] | ||
public function icon_field() { | ||
$this->assertEquals('48', (new Group($this->group, '/Test'))->field('IconID')); | ||
} | ||
} | ||
|