'App\Model\Table\MaterielsTable']; //$config = TableRegistry::exists('Materiels') ? [] : ['className' => MaterielsTable::class]; $config = TableRegistry::getTableLocator()->exists('Materiels') ? [] : ['className' => MaterielsTable::class]; //$this->Materiels = TableRegistry::get('Materiels', $config); $this->Materiels = TableRegistry::getTableLocator()->get('Materiels', $config); } /** * tearDown method * * @return void */ public function tearDown() { unset($this->Materiels); parent::tearDown(); } /** * Test initialize method * * @return void public function testInitialize() { $this->markTestIncomplete('Not implemented yet.'); } */ /** * Test validationDefault method * * @return void public function testValidationDefault() { $this->markTestIncomplete('Not implemented yet.'); } */ /** * Test buildRules method * * @return void public function testBuildRules() { $this->markTestIncomplete('Not implemented yet.'); } */ /** * Test beforeSave method * * @return void public function testBeforeSave() { $this->markTestIncomplete('Not implemented yet.'); } */ /** * Test check_string method * * @return void */ public function testCheck_string() { $result = $this->Materiels->check_string("& materiel"); $this->assertTextEquals(false, $result); $result = $this->Materiels->check_string("materiel"); $this->assertTextEquals(true, $result); } /** * Test check_string_with_some_special_cars method * * @return void */ public function testCheck_string_with_some_special_cars() { $result = $this->Materiels->check_string_with_some_special_cars("$$ materiel"); $this->assertTextEquals(false, $result); $result = $this->Materiels->check_string_with_some_special_cars("& materiel"); $this->assertTextEquals(true, $result); } /** * Test checkStatus method * * @return void */ public function testCheckStatus() { $result = $this->Materiels->checkStatus("pas un status"); $this->assertTextEquals(false, $result); $result = $this->Materiels->checkStatus("CREATE"); $this->assertTextEquals(false, $result); $result = $this->Materiels->checkStatus("CREATED"); $this->assertTextEquals(true, $result); $result = $this->Materiels->checkStatus("VALIDATED"); $this->assertTextEquals(true, $result); $result = $this->Materiels->checkStatus("TOBEARCHIVED"); $this->assertTextEquals(true, $result); $result = $this->Materiels->checkStatus("ARCHIVED"); $this->assertTextEquals(true, $result); } }