| @@ 65-84 (lines=20) @@ | ||
| 62 | * |
|
| 63 | * @return void |
|
| 64 | */ |
|
| 65 | public function hasItem($key) |
|
| 66 | { |
|
| 67 | // get our table name from the constructor |
|
| 68 | $tableName = $this->args[0]; |
|
| 69 | ||
| 70 | // what are we doing? |
|
| 71 | $log = Log::usingLog()->startAction("make sure item '{$key}' exists in the '{$tableName}' table"); |
|
| 72 | ||
| 73 | // does the item exist? |
|
| 74 | $exists = RuntimeTable::fromRuntimeTable($tableName)->hasItem($key); |
|
| 75 | if (!$exists) { |
|
| 76 | $msg = "table does not contain item '{$key}'"; |
|
| 77 | $log->endAction($msg); |
|
| 78 | ||
| 79 | throw Exceptions::newExpectFailedException(__METHOD__, "{$tableName} table has item '{$key}'", "{$tableName} table has no item '{$key}'"); |
|
| 80 | } |
|
| 81 | ||
| 82 | // all done |
|
| 83 | $log->endAction(); |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * doesNotHaveItem |
|
| @@ 94-113 (lines=20) @@ | ||
| 91 | * |
|
| 92 | * @return void |
|
| 93 | */ |
|
| 94 | public function doesNotHaveItem($key) |
|
| 95 | { |
|
| 96 | // get our table name from the constructor |
|
| 97 | $tableName = $this->args[0]; |
|
| 98 | ||
| 99 | // what are we doing? |
|
| 100 | $log = Log::usingLog()->startAction("make sure there is no existing item '{$key}' in '{$tableName}'"); |
|
| 101 | ||
| 102 | // does the item exist? |
|
| 103 | $exists = RuntimeTable::fromRuntimeTable($tableName)->hasItem($key); |
|
| 104 | if ($exists) { |
|
| 105 | $msg = "table contains item '{$key}'"; |
|
| 106 | $log->endAction($msg); |
|
| 107 | ||
| 108 | throw Exceptions::newExpectFailedException(__METHOD__, "{$tableName} table has no item '{$key}'", "{$tableName} table has item '{$key}'"); |
|
| 109 | } |
|
| 110 | ||
| 111 | // all done |
|
| 112 | $log->endAction(); |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * exists |
|