thatModel() public static method

Sample usage: Assert::thatModel(new User(['name' => 'bob']))->hasSameAttributesAs(new User(['name' => 'bob']));
public static thatModel ( Model $actual ) : ModelAssert
$actual Ouzo\Model
return ModelAssert
コード例 #1
0
ファイル: ModelAssertTest.php プロジェクト: letsdrink/ouzo
 /**
  * @test
  */
 public function shouldPassIfModelsAreEqual()
 {
     //given
     $product = new Product(array('name' => 'abc'));
     //when
     $otherProduct = new Product(array('name' => 'abc'));
     //then
     Assert::thatModel($product)->isEqualTo($otherProduct);
 }
コード例 #2
0
ファイル: ControllerTestCase.php プロジェクト: letsdrink/ouzo
 public function assertAssignsModel($variable, $modelObject)
 {
     $modelVariable = $this->requestContext()->getCurrentControllerObject()->view->{$variable};
     $this->assertNotNull($modelVariable);
     Assert::thatModel($modelVariable)->hasSameAttributesAs($modelObject);
 }
コード例 #3
0
 /**
  * @test
  */
 public function shouldSearchForNullValue()
 {
     //given
     $category = Category::create(array('name' => 'shop'));
     $product = Product::create(array('name' => 'notebook', 'id_category' => $category->getId()));
     //when
     $search = Product::where(array('description' => null))->fetch();
     //then
     Assert::thatModel($search)->isEqualTo($product);
 }
コード例 #4
0
ファイル: RestrictionsTest.php プロジェクト: letsdrink/ouzo
 /**
  * @group non-sqlite3
  * @test
  */
 public function shouldReturnModelUsingRegexpRestriction()
 {
     //given
     $product = Product::create(array('name' => 'name1', 'description' => 'desc'));
     Product::create(array('name' => 'other product', 'description' => 'desc'));
     //when
     $loadedProduct = Product::where(array('name' => Restrictions::regexp('ame')))->fetch();
     //then
     Assert::thatModel($loadedProduct)->isEqualTo($product);
 }