php-ipc/tests/Shm/SharedDataTest.php

31 lines
675 B
PHP
Raw Permalink Normal View History

2018-04-15 14:41:46 +00:00
<?php
namespace NoccyLabs\Ipc\Shm;
use NoccyLabs\Ipc\Key\FileKey;
class SharedDataTest extends \PhpUnit\Framework\TestCase
{
public function testOpeningSharedData()
{
$key = new FileKey(__DIR__);
$shm = new SharedData($key);
$this->assertNull($shm->get("foo"));
$this->assertTrue($shm->set("foo", "hello"));
$this->assertEquals("hello", $shm->get("foo"));
$this->assertNull($shm->get("bar"));
$this->assertTrue($shm->set("bar", "world"));
$this->assertEquals("hello", $shm->get("foo"));
$this->assertEquals("world", $shm->get("bar"));
$shm->destroy();
}
}