/** * @test */ public function it_should_create_new_root() { $root = new Tree(['label' => 'root 2']); $rootCount = Tree::find()->roots()->count(); expect('new root created', $root->makeRoot())->true(); expect('new root appeared in the database', Tree::find()->roots()->count())->equals($rootCount + 1); }
public function testCreateNewRoot() { $root = new Tree(['label' => 'root 2']); $this->specify('it should be able to create new root', function () use($root) { $rootCount = Tree::find()->roots()->count(); expect('new root created', $root->makeRoot())->true(); expect('new root appeared in the database', Tree::find()->roots()->count())->equals($rootCount + 1); }); }