actually use local variable (for Codacy)

This commit is contained in:
El RIDO 2016-07-19 08:40:33 +02:00
parent d367655c6d
commit 7d1dc55a27
3 changed files with 10 additions and 9 deletions

View file

@ -236,16 +236,16 @@ class modelTest extends PHPUnit_Framework_TestCase
$this->assertTrue($store->exists($ids[$key]), "paste $key exists after storing it"); $this->assertTrue($store->exists($ids[$key]), "paste $key exists after storing it");
} }
$this->_model->purge(10); $this->_model->purge(10);
foreach (array_keys($ids) as $key) foreach ($ids as $key => $id)
{ {
if (in_array($key, array('x', 'y', 'z'))) if (in_array($key, array('x', 'y', 'z')))
{ {
$this->assertTrue($this->_model->getPaste($ids[$key])->exists(), "paste $key exists after purge"); $this->assertTrue($this->_model->getPaste($id)->exists(), "paste $key exists after purge");
$this->_model->getPaste($ids[$key])->delete(); $this->_model->getPaste($id)->delete();
} }
else else
{ {
$this->assertFalse($this->_model->getPaste($ids[$key])->exists(), "paste $key was purged"); $this->assertFalse($this->_model->getPaste($id)->exists(), "paste $key was purged");
} }
} }
} }

View file

@ -89,11 +89,12 @@ class privatebin_dataTest extends PHPUnit_Framework_TestCase
{ {
if (in_array($key, array('x', 'y', 'z'))) if (in_array($key, array('x', 'y', 'z')))
{ {
$this->assertTrue($this->_model->exists($ids[$key]), "paste $key exists after purge"); $this->assertTrue($this->_model->exists($id), "paste $key exists after purge");
$this->_model->delete($id);
} }
else else
{ {
$this->assertFalse($this->_model->exists($ids[$key]), "paste $key was purged"); $this->assertFalse($this->_model->exists($id), "paste $key was purged");
} }
} }
} }

View file

@ -95,12 +95,12 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase
{ {
if (in_array($key, array('x', 'y', 'z'))) if (in_array($key, array('x', 'y', 'z')))
{ {
$this->assertTrue($this->_model->exists($ids[$key]), "paste $key exists after purge"); $this->assertTrue($this->_model->exists($id), "paste $key exists after purge");
$this->_model->delete($ids[$key]); $this->_model->delete($id);
} }
else else
{ {
$this->assertFalse($this->_model->exists($ids[$key]), "paste $key was purged"); $this->assertFalse($this->_model->exists($id), "paste $key was purged");
} }
} }
} }