Code Duplication    Length = 8-8 lines in 20 locations

modules/unit_test/libraries/Unit_Test.php 20 locations

@@ 236-243 (lines=8) @@
233
     * @param boolean $value
234
     * @param integer $debug
235
     */
236
    public function assert_true($value, $debug = null)
237
    {
238
        if ($value != true) {
239
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_true', gettype($value), var_export($value, true)), $debug);
240
        }
241
242
        return $this;
243
    }
244
245
    public function assert_true_strict($value, $debug = null)
246
    {
@@ 245-252 (lines=8) @@
242
        return $this;
243
    }
244
245
    public function assert_true_strict($value, $debug = null)
246
    {
247
        if ($value !== true) {
248
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_true_strict', gettype($value), var_export($value, true)), $debug);
249
        }
250
251
        return $this;
252
    }
253
254
    /**
255
     * @param boolean $value
@@ 257-264 (lines=8) @@
254
    /**
255
     * @param boolean $value
256
     */
257
    public function assert_false($value, $debug = null)
258
    {
259
        if ($value != false) {
260
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_false', gettype($value), var_export($value, true)), $debug);
261
        }
262
263
        return $this;
264
    }
265
266
    public function assert_false_strict($value, $debug = null)
267
    {
@@ 266-273 (lines=8) @@
263
        return $this;
264
    }
265
266
    public function assert_false_strict($value, $debug = null)
267
    {
268
        if ($value !== false) {
269
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_false_strict', gettype($value), var_export($value, true)), $debug);
270
        }
271
272
        return $this;
273
    }
274
275
    /**
276
     * @param string $expected
@@ 330-337 (lines=8) @@
327
    /**
328
     * @param boolean $value
329
     */
330
    public function assert_boolean($value, $debug = null)
331
    {
332
        if (! is_bool($value)) {
333
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_boolean', gettype($value), var_export($value, true)), $debug);
334
        }
335
336
        return $this;
337
    }
338
339
    /**
340
     * @param string $value
@@ 342-349 (lines=8) @@
339
    /**
340
     * @param string $value
341
     */
342
    public function assert_not_boolean($value, $debug = null)
343
    {
344
        if (is_bool($value)) {
345
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_not_boolean', gettype($value), var_export($value, true)), $debug);
346
        }
347
348
        return $this;
349
    }
350
351
    /**
352
     * @param integer $value
@@ 354-361 (lines=8) @@
351
    /**
352
     * @param integer $value
353
     */
354
    public function assert_integer($value, $debug = null)
355
    {
356
        if (! is_int($value)) {
357
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_integer', gettype($value), var_export($value, true)), $debug);
358
        }
359
360
        return $this;
361
    }
362
363
    /**
364
     * @param string $value
@@ 366-373 (lines=8) @@
363
    /**
364
     * @param string $value
365
     */
366
    public function assert_not_integer($value, $debug = null)
367
    {
368
        if (is_int($value)) {
369
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_not_integer', gettype($value), var_export($value, true)), $debug);
370
        }
371
372
        return $this;
373
    }
374
375
    /**
376
     * @param double $value
@@ 378-385 (lines=8) @@
375
    /**
376
     * @param double $value
377
     */
378
    public function assert_float($value, $debug = null)
379
    {
380
        if (! is_float($value)) {
381
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_float', gettype($value), var_export($value, true)), $debug);
382
        }
383
384
        return $this;
385
    }
386
387
    /**
388
     * @param integer $value
@@ 390-397 (lines=8) @@
387
    /**
388
     * @param integer $value
389
     */
390
    public function assert_not_float($value, $debug = null)
391
    {
392
        if (is_float($value)) {
393
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_not_float', gettype($value), var_export($value, true)), $debug);
394
        }
395
396
        return $this;
397
    }
398
399
    /**
400
     * @param integer[] $value
@@ 402-409 (lines=8) @@
399
    /**
400
     * @param integer[] $value
401
     */
402
    public function assert_array($value, $debug = null)
403
    {
404
        if (! is_array($value)) {
405
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_array', gettype($value), var_export($value, true)), $debug);
406
        }
407
408
        return $this;
409
    }
410
411
    /**
412
     * @param string $key
@@ 414-421 (lines=8) @@
411
    /**
412
     * @param string $key
413
     */
414
    public function assert_array_key($key, $array, $debug = null)
415
    {
416
        if (! array_key_exists($key, $array)) {
417
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_array_key', gettype($key), var_export($key, true)), $debug);
418
        }
419
420
        return $this;
421
    }
422
423
    /**
424
     * @param string $value
@@ 427-434 (lines=8) @@
424
     * @param string $value
425
     * @param string[] $array
426
     */
427
    public function assert_in_array($value, $array, $debug = null)
428
    {
429
        if (! in_array($value, $array)) {
430
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_in_array', gettype($value), var_export($value, true)), $debug);
431
        }
432
433
        return $this;
434
    }
435
436
    /**
437
     * @param string $value
@@ 439-446 (lines=8) @@
436
    /**
437
     * @param string $value
438
     */
439
    public function assert_not_array($value, $debug = null)
440
    {
441
        if (is_array($value)) {
442
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_not_array', gettype($value), var_export($value, true)), $debug);
443
        }
444
445
        return $this;
446
    }
447
448
    /**
449
     * @param stdClass $value
@@ 451-458 (lines=8) @@
448
    /**
449
     * @param stdClass $value
450
     */
451
    public function assert_object($value, $debug = null)
452
    {
453
        if (! is_object($value)) {
454
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_object', gettype($value), var_export($value, true)), $debug);
455
        }
456
457
        return $this;
458
    }
459
460
    /**
461
     * @param string $value
@@ 463-470 (lines=8) @@
460
    /**
461
     * @param string $value
462
     */
463
    public function assert_not_object($value, $debug = null)
464
    {
465
        if (is_object($value)) {
466
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_not_object', gettype($value), var_export($value, true)), $debug);
467
        }
468
469
        return $this;
470
    }
471
472
    public function assert_null($value, $debug = null)
473
    {
@@ 472-479 (lines=8) @@
469
        return $this;
470
    }
471
472
    public function assert_null($value, $debug = null)
473
    {
474
        if ($value !== null) {
475
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_null', gettype($value), var_export($value, true)), $debug);
476
        }
477
478
        return $this;
479
    }
480
481
    /**
482
     * @param integer $value
@@ 484-491 (lines=8) @@
481
    /**
482
     * @param integer $value
483
     */
484
    public function assert_not_null($value, $debug = null)
485
    {
486
        if ($value === null) {
487
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_not_null', gettype($value), var_export($value, true)), $debug);
488
        }
489
490
        return $this;
491
    }
492
493
    /**
494
     * @param string $value
@@ 496-503 (lines=8) @@
493
    /**
494
     * @param string $value
495
     */
496
    public function assert_empty($value, $debug = null)
497
    {
498
        if (! empty($value)) {
499
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_empty', gettype($value), var_export($value, true)), $debug);
500
        }
501
502
        return $this;
503
    }
504
505
    /**
506
     * @param string $value
@@ 508-515 (lines=8) @@
505
    /**
506
     * @param string $value
507
     */
508
    public function assert_not_empty($value, $debug = null)
509
    {
510
        if (empty($value)) {
511
            throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_empty', gettype($value), var_export($value, true)), $debug);
512
        }
513
514
        return $this;
515
    }
516
517
    /**
518
     * @param string $value