Skip to content

Commit

Permalink
Included regresion test for bugix drslump#11
Browse files Browse the repository at this point in the history
  • Loading branch information
drslump committed Apr 18, 2012
1 parent cee1657 commit bdfe1c7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/Protobuf.Codec.Binary.spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
include_once __DIR__ . '/protos/repeated.php';
include_once __DIR__ . '/protos/addressbook.php';

// Include some hamcrest matchers manually since they are not included by default
// TODO: Fix spec4php to include them
include_once 'Hamcrest/Core/IsNot.php';
include_once 'Hamcrest/Core/AllOf.php';


describe "Binary Codec"
Expand Down
37 changes: 37 additions & 0 deletions tests/bugfix-11.spec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

require_once __DIR__ . '/../library/DrSlump/Protobuf.php';

error_reporting(E_ALL);

use \DrSlump\Protobuf;

Protobuf::autoload();

include_once __DIR__ . '/protos/addressbook.php';

describe "Bugfix #11"

before
$codec = new Protobuf\Codec\Binary();
Protobuf::setDefaultCodec($codec);
end
it "should serialize nested message"
$p = new tests\Person();
$p->setName('Foo');
$p->setId(2048);
$p->setEmail('foo@bar.com');
$phoneNumber = new tests\Person\PhoneNumber;
$phoneNumber->setNumber('+8888888888');
$p->setPhone($phoneNumber);
$data = $p->serialize();
$data should be a string
end

end;

0 comments on commit bdfe1c7

Please sign in to comment.