示例#1
0
 public function testGetNumImages()
 {
     $publicKey = 'publickey';
     $image = $this->getImage();
     $this->assertSame(0, $this->adapter->getNumImages($publicKey));
     // Insert first image
     $this->assertTrue($this->adapter->insertImage($publicKey, 'id1', $image));
     $this->assertSame(1, $this->adapter->getNumImages($publicKey));
     // Insert same image
     $this->assertTrue($this->adapter->insertImage($publicKey, 'id1', $image));
     $this->assertSame(1, $this->adapter->getNumImages($publicKey));
     // Insert with a new ID
     $this->assertTrue($this->adapter->insertImage($publicKey, 'id2', $image));
     $this->assertSame(2, $this->adapter->getNumImages($publicKey));
 }
示例#2
0
 public function testGetNumImages()
 {
     $user = '******';
     $image = $this->getImage();
     $this->assertSame(0, $this->adapter->getNumImages($user));
     // Insert on a different user
     $this->assertTrue($this->adapter->insertImage('user2', 'id0', $image));
     $this->assertSame(1, $this->adapter->getNumImages());
     // Insert first image
     $this->assertTrue($this->adapter->insertImage($user, 'id1', $image));
     $this->assertSame(1, $this->adapter->getNumImages($user));
     // Insert same image
     $this->assertTrue($this->adapter->insertImage($user, 'id1', $image));
     $this->assertSame(1, $this->adapter->getNumImages($user));
     // Insert with a new ID
     $this->assertTrue($this->adapter->insertImage($user, 'id2', $image));
     $this->assertSame(2, $this->adapter->getNumImages($user));
     // Count total images, regardless of user
     $this->assertSame(3, $this->adapter->getNumImages());
 }