예제 #1
0
 public function clearModels()
 {
     foreach (Product::find() as $product) {
         $product->delete();
     }
     foreach (Category::find() as $category) {
         $category->delete();
     }
 }
예제 #2
0
 public function testShouldReturnArray()
 {
     $categories = Category::find([['category' => ['$ne' => null]]]);
     $this->assertInternalType('array', $categories->toArray());
     $this->assertSame($categories->count(), count($categories->toArray()));
     $categoriesArray = $categories->toArray();
     $i = 0;
     foreach ($categories as $category) {
         $this->assertEquals((string) $category->getId(), (string) $categoriesArray[$i++]['_id']);
     }
 }
예제 #3
0
 public function setUp()
 {
     foreach (Category::find() as $category) {
         $category->delete();
     }
     foreach (Product::find() as $product) {
         $product->delete();
     }
     // disable cache
     $this->odmMappingCache = Di::getDefault()->get('odmMappingCache');
     Di::getDefault()->remove('odmMappingCache');
 }