31 lines
		
	
	
		
			675 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			675 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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();
 | 
						|
    }
 | 
						|
} |