public function testRemove() { $tc = new TaskCreation($this->container); $tf = new TaskFinder($this->container); $p = new Project($this->container); $c = new Category($this->container); $this->assertEquals(1, $p->create(array('name' => 'Project #1'))); $this->assertEquals(1, $c->create(array('name' => 'Category #1', 'project_id' => 1))); $this->assertEquals(2, $c->create(array('name' => 'Category #2', 'project_id' => 1))); $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'category_id' => 2))); $task = $tf->getById(1); $this->assertTrue(is_array($task)); $this->assertEquals(2, $task['category_id']); $this->assertTrue($c->remove(1)); $this->assertTrue($c->remove(2)); // Make sure tasks assigned with that category are reseted $task = $tf->getById(1); $this->assertTrue(is_array($task)); $this->assertEquals(0, $task['category_id']); }