From 25573a4f3a1884a658e2ce7206abc9caefffd5fa Mon Sep 17 00:00:00 2001 From: David Persson Date: Tue, 8 Mar 2011 20:30:12 +0100 Subject: [PATCH] Adding basic test. --- phpunit.xml | 16 ++++++++++ tests/integration/Socket/ConnectTest.php | 37 ++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 phpunit.xml create mode 100644 tests/integration/Socket/ConnectTest.php diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..f1670c6 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,16 @@ + + + + + + tests/integration + + + + + + + + diff --git a/tests/integration/Socket/ConnectTest.php b/tests/integration/Socket/ConnectTest.php new file mode 100644 index 0000000..af9ff98 --- /dev/null +++ b/tests/integration/Socket/ConnectTest.php @@ -0,0 +1,37 @@ +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); + } +} + +?> \ No newline at end of file