From 7d1dc55a27e4dd8c6380e07c97bb0592ab8a0ba2 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Tue, 19 Jul 2016 08:40:33 +0200 Subject: [PATCH] actually use local variable (for Codacy) --- tst/model.php | 8 ++++---- tst/privatebin/data.php | 5 +++-- tst/privatebin/db.php | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tst/model.php b/tst/model.php index 073d84f..a169c55 100644 --- a/tst/model.php +++ b/tst/model.php @@ -236,16 +236,16 @@ class modelTest extends PHPUnit_Framework_TestCase $this->assertTrue($store->exists($ids[$key]), "paste $key exists after storing it"); } $this->_model->purge(10); - foreach (array_keys($ids) as $key) + foreach ($ids as $key => $id) { if (in_array($key, array('x', 'y', 'z'))) { - $this->assertTrue($this->_model->getPaste($ids[$key])->exists(), "paste $key exists after purge"); - $this->_model->getPaste($ids[$key])->delete(); + $this->assertTrue($this->_model->getPaste($id)->exists(), "paste $key exists after purge"); + $this->_model->getPaste($id)->delete(); } else { - $this->assertFalse($this->_model->getPaste($ids[$key])->exists(), "paste $key was purged"); + $this->assertFalse($this->_model->getPaste($id)->exists(), "paste $key was purged"); } } } diff --git a/tst/privatebin/data.php b/tst/privatebin/data.php index 6184b37..9b4275a 100644 --- a/tst/privatebin/data.php +++ b/tst/privatebin/data.php @@ -89,11 +89,12 @@ class privatebin_dataTest extends PHPUnit_Framework_TestCase { 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 { - $this->assertFalse($this->_model->exists($ids[$key]), "paste $key was purged"); + $this->assertFalse($this->_model->exists($id), "paste $key was purged"); } } } diff --git a/tst/privatebin/db.php b/tst/privatebin/db.php index 0cbf2c1..da3f8e9 100644 --- a/tst/privatebin/db.php +++ b/tst/privatebin/db.php @@ -95,12 +95,12 @@ class privatebin_dbTest extends PHPUnit_Framework_TestCase { if (in_array($key, array('x', 'y', 'z'))) { - $this->assertTrue($this->_model->exists($ids[$key]), "paste $key exists after purge"); - $this->_model->delete($ids[$key]); + $this->assertTrue($this->_model->exists($id), "paste $key exists after purge"); + $this->_model->delete($id); } else { - $this->assertFalse($this->_model->exists($ids[$key]), "paste $key was purged"); + $this->assertFalse($this->_model->exists($id), "paste $key was purged"); } } }