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
Esempio n. 1
0
 /**
  * @test
  */
 public function shouldPassIfModelsAreEqual()
 {
     //given
     $product = new Product(array('name' => 'abc'));
     //when
     $otherProduct = new Product(array('name' => 'abc'));
     //then
     Assert::thatModel($product)->isEqualTo($otherProduct);
 }
Esempio n. 2
0
 public function assertAssignsModel($variable, $modelObject)
 {
     $modelVariable = $this->requestContext()->getCurrentControllerObject()->view->{$variable};
     $this->assertNotNull($modelVariable);
     Assert::thatModel($modelVariable)->hasSameAttributesAs($modelObject);
 }
Esempio n. 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);
 }
Esempio n. 4
0
 /**
  * @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);
 }