-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from cweagans/patch-collection-serialization
Make sure that Patch and PatchCollection objects can be correctly serialized/deserialized
- Loading branch information
Showing
4 changed files
with
135 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace cweagans\Composer\Tests; | ||
|
||
use Codeception\Test\Unit; | ||
use cweagans\Composer\Patch; | ||
|
||
class PatchTest extends Unit | ||
{ | ||
|
||
public function testSerializeDeserialize() | ||
{ | ||
$patch = new Patch(); | ||
$patch->package = 'drupal/drupal'; | ||
$patch->url = 'https://google.com'; | ||
$patch->description = "Test description"; | ||
$patch->depth = 0; | ||
$patch->sha1 = sha1('asdf'); | ||
|
||
$json = json_encode($patch); | ||
|
||
$new_patch = Patch::fromJson($json); | ||
|
||
$this->assertEquals($patch, $new_patch); | ||
} | ||
} |