-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
предварительные доработки закончены, начато внедрение phpunit тестов
- Loading branch information
Ruslan
committed
May 31, 2016
1 parent
1755065
commit cad0b2d
Showing
9 changed files
with
174 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ | |
*.iml | ||
out | ||
gen | ||
*.log | ||
*.log | ||
phpunit.phar |
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,21 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: yarullin | ||
* Date: 31.05.2016 | ||
* Time: 21:12 | ||
*/ | ||
spl_autoload_register(function ($class) { | ||
$parts = explode('\\', $class); | ||
|
||
# Support for non-namespaced classes. | ||
//$parts[] = str_replace('_', DIRECTORY_SEPARATOR, array_pop($parts)); | ||
$parts = [end($parts)]; | ||
|
||
$path = implode(DIRECTORY_SEPARATOR, $parts); | ||
|
||
$file = stream_resolve_include_path(__DIR__ . '/src/' . $path . '.php'); | ||
if ($file !== false) { | ||
require $file; | ||
} | ||
}); |
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
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,45 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: yarullin | ||
* Date: 31.05.2016 | ||
* Time: 21:26 | ||
*/ | ||
|
||
namespace Esockets; | ||
|
||
|
||
class TestEsockets extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var $server \Esockets\Server | ||
* @var $client \Esockets\Client | ||
*/ | ||
private $server, $client; | ||
|
||
public function testServerOpen() | ||
{ | ||
$this->server = new \Esockets\Server(); | ||
$this->assertTrue($this->server->connect(), 'Сервер не создаётся'); | ||
} | ||
|
||
public function testClientConnect() | ||
{ | ||
$this->client = new \Esockets\Client(); | ||
$this->assertTrue($this->client->connect(), 'Клиент не может соединиться'); | ||
} | ||
|
||
public function testServerAcceptClient() | ||
{ | ||
$this->server->onConnectPeer(function (\Esockets\Peer $peer) { | ||
|
||
}); | ||
|
||
$this->server->listen(); | ||
} | ||
|
||
public function testClientSendData() | ||
{ | ||
$this->assertTrue($this->client->send('Hello world'), 'Клиент не может отправить данные'); | ||
} | ||
} |