Skip to content

Commit

Permalink
Adding basic test.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuswilms committed Mar 8, 2011
1 parent e3e0128 commit 25573a4
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
16 changes: 16 additions & 0 deletions phpunit.xml
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
syntaxCheck="false">
<testsuites>
<testsuite name="PHP">
<directory suffix="Test.php">tests/integration</directory>
</testsuite>
</testsuites>
<php>
<const name="TEST_EXECUTION" value="true" />
<const name="TEST_SERVER_HOST" value="127.0.0.1" />
<const name="TEST_SERVER_PORT" value="11301" />
</php>
</phpunit>
37 changes: 37 additions & 0 deletions tests/integration/Socket/ConnectTest.php
@@ -0,0 +1,37 @@
<?php

require_once 'Socket/Beanstalk.php';

class ConnectTest extends PHPUnit_Framework_TestCase {

public $subject;

protected function setUp() {
$this->subject = new Socket_Beanstalk(array(
'host' => TEST_SERVER_HOST,
'port' => TEST_SERVER_PORT
));
if (!$this->subject->connect()) {
$message = 'Need a running beanstalk server at ' . TEST_SERVER_HOST . ':' . TEST_SERVER_PORT;
$this->markTestSkipped($message);
}
}

public function testConnection() {
$this->subject->disconnect();

$result = $this->subject->connect();
$this->assertTrue($result);

$result = $this->subject->connected;
$this->assertTrue($result);

$result = $this->subject->disconnect();
$this->assertTrue($result);

$result = $this->subject->connected;
$this->assertFalse($result);
}
}

?>

0 comments on commit 25573a4

Please sign in to comment.