Skip to content

Commit

Permalink
Debug Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavier HAUSHERR committed Jan 14, 2015
1 parent d950a63 commit 8724ee5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
17 changes: 7 additions & 10 deletions Tests/Client/ThriftClientTest.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ protected function setUp()
$this->factory = new ThriftFactory(array(
'test' => array(
'definition' => 'Test',
'className' => 'Test',
'className' => 'TestService',
'namespace' => 'ThriftModel\Test'
)
));
$this->factory->initLoader(array(
'ThriftModel' => __DIR__ . '/..'
));
}

public function testHttpClient()
Expand All @@ -50,13 +47,13 @@ public function testHttpClient()
),
'service_config' => array(
'definition' => 'Test',
'className' => 'Test',
'className' => 'TestService',
'namespace' => 'ThriftModel\Test',
'protocol' => 'Thrift\\Protocol\\TBinaryProtocolAccelerated'
)
));

$this->assertInstanceOf('ThriftModel\Test\TestClient', $thriftClient->getClient());
$this->assertInstanceOf('ThriftModel\Test\TestServiceClient', $thriftClient->getClient());

$this->assertInstanceOf(
'ThriftModel\Test\Test',
Expand Down Expand Up @@ -101,7 +98,7 @@ public function testSocketClient__NoServer()
'TSocket: Could not connect to localhost:9090 (Connexion refusée [111])'
);

$this->assertInstanceOf('ThriftModel\Test\TestClient', $thriftClient->getClient());
$this->assertInstanceOf('ThriftModel\Test\TestServiceClient', $thriftClient->getClient());
}

public function testSocketClient()
Expand All @@ -118,7 +115,7 @@ public function testSocketClient()
$processor = $this->factory->getProcessorInstance('test', $handler);

$this->assertInstanceOf(
'ThriftModel\Test\TestProcessor',
'ThriftModel\Test\TestServiceProcessor',
$processor
);

Expand All @@ -143,7 +140,7 @@ public function testSocketClient()
sleep(2);

$client = $thriftClient->getClient();
$this->assertInstanceOf('ThriftModel\Test\TestClient', $client);
$this->assertInstanceOf('ThriftModel\Test\TestServiceClient', $client);

// Void Method
$this->assertNull($client->ping());
Expand Down Expand Up @@ -242,7 +239,7 @@ public function testMultiSocketClient()
),
'service_config' => array(
'definition' => 'Test',
'className' => 'Test',
'className' => 'TestService',
'namespace' => 'ThriftModel\Test',
'protocol' => 'Thrift\\Protocol\\TBinaryProtocolAccelerated'
)
Expand Down
9 changes: 3 additions & 6 deletions Tests/Factory/ThriftFactoryTest.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ public function testFactory()
$factory = new ThriftFactory(array(
'test' => array(
'definition' => 'Test',
'className' => 'Test',
'className' => 'TestService',
'namespace' => 'ThriftModel\Test'
)
));
$factory->initLoader(array(
'ThriftModel' => __DIR__ . '/..'
));

$this->assertInstanceOf(
'ThriftModel\Test\Test',
Expand All @@ -51,12 +48,12 @@ public function testFactory()
);

$this->assertInstanceOf(
'ThriftModel\Test\TestProcessor',
'ThriftModel\Test\TestServiceProcessor',
$factory->getProcessorInstance('test', null)
);

$this->assertInstanceOf(
'ThriftModel\Test\TestClient',
'ThriftModel\Test\TestServiceClient',
$factory->getClientInstance('test', null)
);
}
Expand Down
6 changes: 6 additions & 0 deletions Tests/ThriftBundleTestCase.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Overblog\ThriftBundle\Tests;

use Overblog\ThriftBundle\Compiler\ThriftCompiler;
use Symfony\Component\ClassLoader\MapClassLoader;
use Symfony\Component\ClassLoader\ClassMapGenerator;

class ThriftBundleTestCase extends \PHPUnit_Framework_TestCase
{
Expand All @@ -23,6 +25,10 @@ protected function compile()
$this->compiler = new ThriftCompiler();
$this->compiler->setModelPath($this->modelPath);
$this->compiler->compile($this->definitionPath, true);

// Init Loader
$l = new MapClassLoader(ClassMapGenerator::createMap($this->modelPath));
$l->register();
}

protected function tearDown()
Expand Down
2 changes: 1 addition & 1 deletion Tests/ThriftDefinition/Test.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exception InvalidValueException {
2: string error_msg
}

service Test {
service TestService {
void ping(),
Test get(1: i32 id) throws (1: InvalidValueException e),
list<Test> getList(1: i32 id) throws (1: InvalidValueException e),
Expand Down
3 changes: 2 additions & 1 deletion composer.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
],
"require": {
"php": ">=5.3.0",
"apache/thrift": ">=0.9.1"
"apache/thrift": ">=0.9.1",
"symfony/symfony": ">=2.4.0"
},
"target-dir": "Overblog/ThriftBundle",
"autoload": {
Expand Down

0 comments on commit 8724ee5

Please sign in to comment.