Completed
Pull Request — master (#163)
by Corey
03:20
created

CategoryTest::testRules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace common\unit\models;
4
5
use Yii;
6
use Codeception\Specify;
7
use common\models\Category;
8
9
date_default_timezone_set('UTC');
10
11
/**
12
 * Time test
13
 */
14
15
class CategoryTest extends \Codeception\Test\Unit {
16
  use Specify;
17
18
  public function testRules() {
19
    $category = new Category;
20
    expect('rules', $this->assertEquals($category->rules(), [
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->assertEquals($cat...tring', 'max' => 255))) targeting PHPUnit\Framework\Assert::assertEquals() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
21
      ['name', 'required'],
22
      ['name', 'string', 'max' => 255],
23
    ]));
24
  }
25
26
  public function testAttributeLabels() {
27
    $category = new Category;
28
    expect('attributeLabels', $this->assertEquals($category->attributeLabels(), [
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->assertEquals($cat...ID', 'name' => 'Name')) targeting PHPUnit\Framework\Assert::assertEquals() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
29
      'id' => 'ID',
30
      'name' => 'Name',
31
    ]));
32
  }
33
34
  public function testGetCategories() {
35
    expect('getCategories', $this->assertEquals(Category::getCategories(), [
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->assertEquals(comm...elapse/Moral Failure')) targeting PHPUnit\Framework\Assert::assertEquals() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
36
      1 => 'Restoration',
37
      2 => 'Forgetting Priorities',
38
      3 => 'Anxiety',
39
      4 => 'Speeding Up',
40
      5 => 'Ticked Off',
41
      6 => 'Exhausted',
42
      7 => 'Relapse/Moral Failure',
43
    ]));
44
  }
45
46
  public function testGetCategory() {
47
    expect('getCategory', $this->assertEquals(Category::getCategory('id', 3), ["id" => 3, "name" => "Anxiety"]));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->assertEquals(comm..., 'name' => 'Anxiety')) targeting PHPUnit\Framework\Assert::assertEquals() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
48
  }
49
}
50